This repository brings together a set of user-defined functions (UDFs) developed for VBA and Power Query (M), with the goal of extending the native capabilities of Excel and Power BI. Here you will find both functions created by me and useful functions developed by others β always properly organized, documented, and referenced.
- To centralize, organize, and facilitate access to a catalog of reusable functions
- To accelerate the development of solutions in Excel, Power Query, and Power BI.
- To maintain a versioned and easily searchable repository.
- To reuse functions tested and validated in different contexts.
| Function | Description | Documentation |
|---|---|---|
Binary.Unzip |
Extracts file from a compressed ZIP file | π |
DateTime.ToUnixTime |
Converts a datetime format to Unix Time Stamp | π |
Decision.EntropyWeights |
Calculates the weights of a decision multicriteria using the entropy weighting method | π |
Decision.TOPSIS |
Applies the TOPSIS multicriteria method to a table in order to rank alternatives | π |
List.Correlation |
Calculates the correlation coefficient between two lists of numeric values | π |
List.Intercept |
Calculates the intercept B of the linear regression line Y = AX + B between two numerical lists X and Y | π |
List.Outliers |
Returns a numerical list of outliers existing in a list | π |
List.PopulationStdDev |
Calculates the population standard deviation of a numerical list | π |
List.Primes |
Returns a list of prime numbers less than or equal to a given number n | π |
List.Rank |
Returns a list of ranks for a given list of values | π |
List.Slope |
Calculates the slope A of the linear regression Y = AX + B between two numerical lists X and Y | π |
List.Variance |
Calculates the population variance of a numerical list | π |
List.WeightedAverage |
Calculates the weighted average of a list of values given a corresponding list of weights | π |
Number.FromRoman |
Converts a Roman numeral to a number | π |
Number.IsInteger |
Checks if a number is integer or not | π |
Number.IsPrime |
Checks if a number is prime or not | π |
Number.ToRoman |
Converts a number to Roman numeral, if it's possible | π |
Statistical.NormDist |
Calculates the Normal distribution for a given input x | π |
Statistical.NormInv |
Returns the inverse of the CDF of the normal distribution | π |
Table.AddColumnFromList |
Adds a new column to a table using values from a provided list | π |
Table.CorrelationMatrix |
Calculates the correlation matrix for a given table | π |
Table.NormalizeColumnNames |
Cleans and standardizes column names in a table | π |
Table.NormalizeTextColumns |
Cleans, standardizes and formats column names in a table | π |
Table.NormalizeTextColumns |
Cleans, standardizes and formats text columns in a table | π |
Table.RemoveBlankColumns |
Removes columns from a table that contain only blank values | π |
Table.TransposeCorrectly |
Transposes a table without losing the original column names | π |
Text.CountChar |
Counts the occurrences of a specific character in a given text string | π |
Text.ExtractNumbers |
Returns all numeric values from a given text | π |
Text.HtmlToPlainText |
Converts HTML content to plain text | π |
Text.RegexExtract |
Extracts a pattern from a text by using a regular expression | π |
Text.RegexReplace |
Replaces a pattern in a text that match a given regular expression | π |
Text.RegexSplit |
Splits a text into a list of strings based on a regular expression pattern | π |
Text.RegexTest |
Tests whether a text matches a regular expression pattern | π |
Text.RemoveAccents |
Removes any accent from characters in a text | π |
Text.RemoveDoubleSpaces |
Replaces any sequence of multiple spaces in a text to sigle spaces | π |
Text.RemoveLetters |
Removes all alphabetic characters from a text | π |
Text.RemoveNumerals |
Removes all digits from a text | π |
Text.RemovePunctuations |
Removes all punctuations from a text | π |
Text.RemoveStopwords |
Removes common Portuguese stopwords from a text | π |
Text.RemoveWeirdChars |
Removes special and non-printable characters from a text | π |
| Function | Description | Documentation |
|---|---|---|
AreArraysEquals |
Checks if two arrays are equal | π |
AutoFillFormulas |
Automatically fills formulas across a range using a reference cell's formula | π |
CleanString |
Cleans a string by removing or replacing special and control characters with spaces | π |
DisableRefreshAll |
Disables the "Refresh All" option for all OLEDB connections in a workbook | π |
EnableRefreshAll |
Enables the "Refresh All" option for all OLEDB connections in a workbook | π |
FileExists |
Checks if a file exists at the specified file path. | π |
FileNameIsValid |
Checks if a given name can be used as a valid file name | π |
GetAllFileNames |
Retrieves an array of all file names from a folder and its subfolders | π |
GetLetters |
Extracts ASCII letters from a string, in lowercase/td> | π |
GetMonthNumberFromName |
Converts a month name to its corresponding numeric value | π |
GetStringBetween |
Extracts a string between two specified delimiters | π |
GetStringWithSubstringInArray |
Searches through an array of strings and returns the first string that contains a specified substring | π |
GetTableColumnNames |
Returns the column names of an Excel table | π |
IsAllTrue |
Checks if all elements in a boolean array are True |
π |
IsInArray |
Checks whether a value exists in an array | π |
ListObjectExists |
Checks whether a ListObject (Excel table) exists in a workbook | π |
PreviousMonthNumber |
Returns the month's number that precedes the month of a given date | π |
RangeHasAnyFormula |
Checks if a range contains any cell with formulas | π |
RangeHasConstantValues |
Checks if a range contains any constant (non-formula) cell | π |
RangeIsHidden |
Checks if a range has no visible cell | π |
RangeToHtml |
Converts a range into an HTML string | π |
SendEmail |
Sends an HTML email using CDO with NTLM authentication | π |
SetQueryFormula |
Sets a Power Query formula for a query in the current workbook | π |
StringContains |
Checks if a string contains a substring | π |
StringEndsWith |
Checks if a string ends with a specified substring | π |
StringStartsWith |
Checks if a string starts with a specified substring | π |
SubstringIsInArray |
Searches a array for any string element that contains a specified substring and returns True on the first match |
π |
Summation |
Computes the numeric summation of a mathematical expression over an integer index range | π |
TableHasQuery |
Checks if a ListObject (Excel table) is associated to a query | π |
WorksheetHasListObject |
Checks if a worksheet contains a ListObject (Excel table) | π |
Contributions are welcome! If you have an interesting feature, improvement, or fix for any function or documentation, feel free to open a pull request or an issue.
Here is a list of very useful repos of user-defined functions:
- M by Imke Feldmann
- M Custom Functions by Ε tΔpΓ‘n ReΕ‘l
- m-custom-functions by Tirnovar
- M-tools by Kim Burgess
- PowerBi-code by ibarrau
- PowerQueryFunctions by OscarValerock
- PowerQueryLib by NinMonkey