This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| DESCRIBE | |
| Creates tables of statistics similar to the Analysis Toolpak Add-in "Summary statistics" feature. | |
| Including support for text columns and additional statistics for numeric columns. | |
| Inputs | |
| - data: a range or array of data with at least one column | |
| - has_header: TRUE if data includes a header row, FALSE otherwise | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| GROUPAGGREGATE | |
| Creates summary tables of data similar to SQL's GROUP BY queries | |
| Inputs | |
| - dat: a range or array of data with at least two columns, | |
| one of which's control value must be "group" and one not "group" | |
| - control: a single-row array, where COLUMNS(control)=COLUMNS(dat), of values from this list: | |
| group - the values in this column will be output as row headers |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| RECURSIVEFILTER | |
| Filters an array or range recursively using a list of columns and criteria to apply | |
| Inputs | |
| - dat: the array or range of data to filter | |
| - cols: Either a one-dimensional horizontal array of column indices representing | |
| columns in dat. e.g. {1,2} means "filter columns 1 and 2" | |
| OR |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| LEV | |
| Calculates the Levenshtein distance between two strings | |
| Inputs | |
| - a: a string to compare with b | |
| - b: a string to compare with a | |
| - [ii]: the [ii]th position in string a | |
| - [jj]: the [jj]th position in string b |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| AVE7DAYS = LAMBDA(range, | |
| iferror(average(offset(range,-6,0,7,1)),"") | |
| ); | |
| ROC7DAYS = LAMBDA(range,ifzero, | |
| if(row(range)>14,iferror( | |
| if(sum(offset(range,-6,0,7,1))/sum(offset(range,-13,0,7,1))<>0, | |
| sum(offset(range,-6,0,7,1))/sum(offset(range,-13,0,7,1)),ifzero), | |
| ifzero),"") | |
| ) | |
| ; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Returns the day of the week for the provided date, | |
| * where Monday is the first day. | |
| */ | |
| dayOfWeek = LAMBDA(datetime, WEEKDAY(datetime, 2)); | |
| /** | |
| * Returns the name for the day of the week for the provided date. | |
| */ | |
| dayOfWeekName = LAMBDA(datetime, TEXT(datetime, "dddd")); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| NumberToWords = LAMBDA(DNumValue, CUR, DecimalCUR, DecimalCURPlace, | |
| LET( | |
| NumValue, INT(DNumValue), | |
| Words1,IFS( | |
| len(NumValue)=1,GetDigit(value(NumValue)) & " " & CUR, | |
| len(NumValue)=2,GetTens(value(NumValue))& " " & CUR, | |
| len(NumValue)=3,GetHundreds(value(NumValue))& " " & CUR, | |
| len(NumValue)<=6,GetHundreds(VALUE(left(NumValue,len(NumValue)-3))) & " Thousand " & GetHundreds(value(NumValue))& " " & CUR, | |
| len(NumValue)<=9,GetHundreds(VALUE(left(NumValue,len(NumValue)-6))) & " Million " & GetHundreds(VALUE(left(NumValue,len(NumValue)-3))) & " Thousand " & GetHundreds(value(NumValue))& " " & CUR, | |
| len(NumValue)<=12,GetHundreds(VALUE(left(NumValue,len(NumValue)-9))) & " Billion " & GetHundreds(VALUE(left(NumValue,len(NumValue)-6))) & " Million " & GetHundreds(VALUE(left(NumValue,len(NumValue)-3))) & " Thousand " & GetHundreds(value(NumValue))& " " & CUR), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* FillUp/FillDown column range functions | |
| Sergei Baklan | |
| Updated 2022-03-05 | |
| -------------------------------------------------------*/ | |
| /* | |
| FUNCTION NAME: IFBLANK | |
| based on Chris Gross function | |
| https://gist.github.com/chgrossMSFT/d172fd552cf6893bcdc7942223cb0e55 | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // This gist containt useful pieces of M Query code |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //All in 1 change formulas, EXCEPT EARNINGS RATIO------------------ | |
| //New is the column with the most recent values | |
| //Old is the column with the older values | |
| Change= | |
| LAMBDA( | |
| NEW, OLD, | |
| IFERROR(IF(AND(LEFT(CELL("format",NEW),1)="P", LEFT(CELL("format",OLD),1)="P"), | |
| NEW-OLD, |