Skip to content

rodrigo-cl-porto/User-Defined-Functions

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

User Defined Functions

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.

🎯 Objective

  • 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.

Table of Contents

M Code (Power Query)

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 πŸ“„

VBA (Visual Basic Application)

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

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.

πŸ—‚οΈ Other UDF Repositories

Here is a list of very useful repos of user-defined functions:

Releases

No releases published

Packages

No packages published