Fx
The Fx() function allows Excel functions to behave like Quintessence functions. When an Excel array function is passed to the Fx() function, it automatically expands into its array constituents.
Syntax
Fx (Value)
Value | Any Quintessence or Excel function |
Sparse | This parameter instructs the function not to overwrite any unmatched cells within the output data, for example when used with AlignToAxes(). |
Note:
Input parameters can consist of Quintessence functions. This includes functions that return ranges in cases where a parameter value can be a range.
Examples
Example 1. Use Fx to iteratively evaluate every line in a range
Example 2. Using Fx with the ‘Sparse’ parameter to control layout
Example 3. Using Fx to expand an array for use by the Excel Linest() function
Note:
How your system administrator configured Quintessence determines which function parameters are required. In most implementations, administrators configure functions so that certain parameters default to specific values when left blank.
Example 1. Using Fx to iteratively evaluate every line in a range
Without the Fx function
The goal is to categorise the value of the various asset holdings, where a value less than 1000000 is considered ‘Low’ and anything equal to or above 100000 is ‘High’. Without using the Fx function, only the first row is evaluated by the IF function, despite referencing the array B2 to B8.
Asset | Market value | Category |
LEF | 808000 | =IF(B2:B8 < 1000000,‘Low‘,‘High‘) |
GTE | 96000 | |
JWQ | 808000 | |
VWE | 5050000 | |
TVJ | 480000 | |
THT | 240000 | |
GZW | 1010000 |
Asset | Market value | Output (incorrect) |
LEF | 808000 | Low |
GTE | 96000 | |
JWQ | 808000 | |
VWE | 5050000 | |
TVJ | 480000 | |
THT | 240000 | |
GZW | 1010000 |
With the Fx function
By using the Fx function, the entire range (B2:B8) is evaluated by the IF function, resulting in the correct output.
Asset | Market value | Category |
LEF | 808000 | =Fx(IF(B2:B8 < 1000000,‘Low‘,‘High‘)) |
GTE | 96000 | |
JWQ | 808000 | |
VWE | 5050000 | |
TVJ | 480000 | |
THT | 240000 | |
GZW | 1010000 |
Asset | Market value | Output (correct) |
LEF | 808000 | Low |
GTE | 96000 | Low |
JWQ | 808000 | Low |
VWE | 5050000 | High |
TVJ | 480000 | Low |
THT | 240000 | Low |
GZW | 1010000 | High |
Example 2. Using Fx with the ‘Sparse’ parameter to control layout
The Fx() function can be used to prevent data from being overwritten by setting the Sparse parameter to TRUE. In this example, the AlignToAxes() function is used in a report which contains predefined formulas. The AlignToAxes() function is passed to the Fx() function. Fx() is provided with an additional parameter (Sparse = TRUE) which instructs it to retain internal unmatched information within the output block. Therefore the first row of totals is not overwritten.
Range | Align to axes | |||||||
Portfolio | Asset | Date | Income | YLG | CFH | |||
5010 | YLG | 31 Mar 2014 | 250 | 5010 | 31 Mar 2014 | =Fx(AlignToAxes(A2:D10, F3:G7,H2:I2,”none”,”C1,C3″,”C2″,”C4″),TRUE) | ||
5010 | YLG | 30 Jun 2014 | 300 | 5010 | 30 Jun 2014 | |||
5010 | CFH | 31 Mar 2014 | 125 | TOTAL | =SUM(H3:H4) | =SUM(I3:I4) | ||
5010 | CFH | 30 Jun 2014 | 325 | 5030 | 31 Mar 2014 | |||
5030 | YLG | 31 Mar 2014 | 100 | 5030 | 30 Jun 2014 | |||
5030 | YLG | 30 Jun 2014 | 240 | TOTAL | =SUM(H6:H7) | =SUM(I6:I7) | ||
5030 | CFH | 31 Mar 2014 | 200 | |||||
5030 | CFH | 30 Jun 2014 | 90 |
Range | Output | |||||||
Portfolio | Asset | Date | Income | YLG | CFH | |||
5010 | YLG | 31 Mar 2014 | 250 | 5010 | 31 Mar 2014 | 250 | 125 | |
5010 | YLG | 30 Jun 2014 | 300 | 5010 | 30 Jun 2014 | 300 | 325 | |
5010 | CFH | 31 Mar 2014 | 125 | TOTAL | 550 | 450 | ||
5010 | CFH | 30 Jun 2014 | 325 | 5030 | 31 Mar 2014 | 100 | 200 | |
5030 | YLG | 31 Mar 2014 | 100 | 5030 | 30 Jun 2014 | 240 | 90 | |
5030 | YLG | 30 Jun 2014 | 240 | TOTAL | 340 | 290 | ||
5030 | CFH | 31 Mar 2014 | 200 | |||||
5030 | CFH | 30 Jun 2014 | 90 |
If the Fx() function had not been used, or Sparse had not been set to TRUE, the internal unmatched information would have been overwritten, in this case the first row of Totals.
Range | Output | |||||||
Portfolio | Asset | Date | Income | YLG | CFH | |||
5010 | YLG | 31 Mar 2014 | 250 | 5010 | 31 Mar 2014 | 250 | 125 | |
5010 | YLG | 30 Jun 2014 | 300 | 5010 | 30 Jun 2014 | 300 | 325 | |
5010 | CFH | 31 Mar 2014 | 125 | TOTAL | ||||
5010 | CFH | 30 Jun 2014 | 325 | 5030 | 31 Mar 2014 | 100 | 200 | |
5030 | YLG | 31 Mar 2014 | 100 | 5030 | 30 Jun 2014 | 240 | 90 | |
5030 | YLG | 30 Jun 2014 | 240 | TOTAL | 340 | 290 | ||
5030 | CFH | 31 Mar 2014 | 200 | |||||
5030 | CFH | 30 Jun 2014 | 90 |
Example 3. Using Fx to expand input into an array for use by the Excel Linest() function
In the first function in this example, Linest() only returns one value, which is incorrect. This is because the function is not treating the input ranges as arrays.
Linest |
=LINEST(A2:A5,B2:B5,TRUE,TRUE) |
Range | Output | |||
8 | 6 | 1.3 | ||
9 | 7 | |||
10 | 8 | |||
12 | 9 |
In Excel, a function can be made to recognise an input range as an array by selecting the output range and then typing CTRL+SHIFT+ENTER. This places brackets around the function {} as shown below. The size of the output range needs to be known in advance.
Linest using Ctrl+Shift+Enter |
{=LINEST(A2:A5,B2:B5,TRUE,TRUE)} |
Range | Output | |||
8 | 6 | 1.3 | 0 | |
9 | 7 | 0.173205081 | 1.313392554 | |
10 | 8 | 0.965714286 | 0.387298335 | |
12 | 9 | 56.33333333 | 2 | |
8.45 | 0.3 |
By enclosing the Linest() function in the Fx() function, the range is expanded into an array, without the need to type CTRL+SHIFT+ENTER. The result is the same, but there is no need to select the output range.
Linest using Fx |
=Fx(LINEST(A2:A5,B2:B5,TRUE,TRUE)) |
Range | Output | |||
8 | 6 | 1.3 | 0 | |
9 | 7 | 0.173205081 | 1.313392554 | |
10 | 8 | 0.965714286 | 0.387298335 | |
12 | 9 | 56.33333333 | 2 | |
8.45 | 0.3 |