Last active
September 21, 2024 11:12
-
-
Save ExcelRobot/041ee42f2fdf98f441ea508979ad0040 to your computer and use it in GitHub Desktop.
Format Formula LAMBDA Function
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
/* | |
Name: Format Formula (FormatFormula) | |
Description: Uses OA Robot formula formatting api to format a formula to make it easier to read. | |
Parameters: | |
CellOrFormula - Reference to cell containing a formula or a formula as text | |
Compact - True to remove all whitespace (default: False) | |
Source: @ExcelRobot, https://www.oarobot.com | |
*/ | |
FormatFormula = LAMBDA(CellOrFormula, [Compact], LET( | |
\\LambdaName, "FormatFormula", | |
\\CommandName, "Format Formula", | |
\\Description, "Uses OA Robot formula formatting api to format a formula to make it easier to read.", | |
\\Parameters, { | |
"CellOrFormula","Reference to cell containing a formula or a formula as text"; | |
"Compact", "True to remove all whitespace (default: False)" | |
}, | |
\\Source, "@ExcelRobot, https://www.oarobot.com", | |
_Formula, IF( | |
IFERROR(ISFORMULA(CellOrFormula), FALSE), | |
FORMULATEXT(CellOrFormula), | |
CellOrFormula | |
), | |
_JoinWaitListAt, "oarobot.com", | |
_FormatFormulaURL, "https://api." & _JoinWaitListAt & "/api/format", | |
_QueryParameter, "formula=" & ENCODEURL(_Formula) & if(Compact,"&compact=true",""), | |
_FormattedFormula, WEBSERVICE(_FormatFormulaURL & "?" & _QueryParameter), | |
_FormattedFormula | |
)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment