Jul.

2

2008

Using IF THEN Calculations in FRx

by Jan Harrigan CPA

You should know that IF THEN calculations are not only possible in FRx, you can use them in both the row and the column.

In the Row, use a CAL format code, then place your IF THEN statement in column D Related Rows.

In the column, use a CALC column type, then place your IF THEN statement in the Calc Formula cell.

The syntax is as follows:
If (true/false statement) Then (formula) Else (formula)

Don’t use commas. The ELSE segment is optional. In the row, row codes are used in the true/false statement and formula. For example, “If B200>0 Then B200 Else C215″. In the column, column letters are used instead: “If B>0 Then B Else C”.

These are simple examples but they can get much more complex.

I use an IF THEN most often in the row to switch intercompany receivables and payables between asset and liability sections depending on whether there’s a debit or credit balance.

Be Sociable, Share!

{ 40 comments… read them below or add one }

Jeff September 2, 2008 at 7:13 pm

Here’s another not-so-obvious trick with calculations in FRx. This can be used for various things, but I’ll use the example of multiplying by a currency rate.

Use IF @UNIT() calculations in the row format to define the rate for each unit, then just use a CALC column to multiply by your rate row. This is a bit harder to explain, but you basically end up with something like this in the row format:

MYRATE My exchange rate CAL 1.5678 “0.000000″ NP
NO_RATE No conversion CAL 1 NP
11 Company1 CAL IF @UNIT(COMPANY1) THEN @MYRATE ELSE @12 NP
12 Company2 CAL IF @UNIT(COMPANY2) THEN @MYRATE ELSE @13 NP
13 Company3 CAL IF @UNIT(COMPANY3) THEN @MYRATE ELSE @14 NP
14 Company4 CAL IF @UNIT(COMPANY4) THEN @MYRATE ELSE @15 NP
15 Company5 CAL IF @UNIT(COMPANY5) THEN @NO_RATE ELSE @16 NP
16 Company6 CAL IF @UNIT(COMPANY6) THEN @NO_RATE NP

You then have one GL column and one CALC column in the column layout. Your CALC column would use a formula of B*B11. When you generate the report, FRx will start at row 11 and then fall through each CAL row until it hits the right one.

You can combine this with XR and other functionality to do some pretty cool stuff. There are probably some good, creative uses of this without @UNIT(), too.

Jan Harrigan CPA September 2, 2008 at 8:22 pm

Folks, Jeff is one of the lead developers of FRx. Doesn’t get much better than this! Jan

Anonymous November 21, 2008 at 10:59 am

I don’t get any of this please help!

Jan Harrigan CPA November 21, 2008 at 11:09 am

I’d recommend you go to FRx Help and search for IF/THEN/ELSE. Review that, then come back here. Good luck.

Andrew Halwa January 30, 2009 at 12:47 pm

Is there a way to get my report to only display lines that meet a certain IF criteria. For example I am trying to display only variances over $5000. I’ve used one column to calculate the absolute value for each variance, but I only want to see the rows that exceed 5000. Thank you in advance for any help.

Andrew Halwa January 30, 2009 at 3:47 pm

Nm the last post I figured it out. Is there anyway to combine statements though? I need variances >10% of budget or >$5000. I’m able to get one column to display variances >5000 and another column to show variances>10% of budget but I’m wondering if there is a way to get one column to show values where either criteria is met. I am using “IF(ABS(E)>5000) THEN E” & in the next column “IF(abs(E/D)>0.1) THEN E”.

Simon N March 25, 2009 at 9:42 am

Does anyone know if you can do an: IF/THEN/IF/ THEN/ ELSE?

Jeff [MSFT] March 25, 2009 at 8:10 pm

Simon,

You can’t do that in a single column, but you can accomplish the same type of thing by using multiple columns. For example:

A, DESC
B, GL
C, CALC, IF B>0 THEN D
D, CALC, IF B>1000 THEN 1000 ELSE B, NP

This is the same as having IF B>0 THEN IF B>1000 THEN 1000 ELSE B, you just have to break it out into multiple columns. You could even have an IF/THEN D ELSE E in column C, then have different IF/THEN/ELSE formulas in D and E … those might even refer to other columns with IF/THEN/ELSE formulas.

This also works in rows, but make sure your row and column formulas don’t collide since only one can win (defined by your report’s calculation priority).

Hope this helps.

Jeff

Jan Harrigan CPA March 25, 2009 at 8:23 pm

Hey thanks Jeff—I may have a use for that tomorrow!

I also do this in a row to make an ‘out of balance’ row calc to -0- so it doesn’t print due to rounding:
900 Out of balance TOT 830-800 NP
930 Out of balance CAL IF @900 < -4 or @900 >4 THEN @900 ELSE 0

Not exactly the same thing as a nested if/then but it works great in this instance. Jan

Jeff [MSFT] March 25, 2009 at 8:25 pm

To add a couple tidbits to Jan’s post …

* You can reference individual rows in column formulas – for example, a CALC column could contain the formula IF B200 > 0 THEN C ELSE D. This can be useful to accomplish base row-like functionality, something like C/B100

* In row calculations, if you want to reference the value for a row in the current column, you use @ROW#. For example, if you want a row to show one row’s value divided by another and have that value be appropriate to each column, you might use IF @100>0 THEN @100 ELSE @200

* If you want to use a row with a text label in a calculation, you reference it with the column letter, a dot, and the row number. For example: B.ASSETS

JAD March 26, 2009 at 12:09 pm

I am trying to use the IF/THEN statement to create a p&L that shows the revenue and salaries for one department containg professional staff separately at the top of the report. Below that information is another salary row for departments for non-professional staff. I am using the @unit statement in the row format and if the unit contains is equal to the professional staff department then FRX branches to a row that contains the accounts in the LINK to GL column, including the department segment as DEP-????-ACCT-????-????. The Else statement is equal to “0″. That is not working because the summary p&L does not include the rollup. If I include an else statement that branches to list the natural accounts only (as ACCT????) minus DEP-????-ACCT-????-???? I get duplicate values. How can I fix that so only one department and the summary rollup contains the rows for the professional staff department and the non-professional staff departments show the correct amounts? I played around with the tree and row format and I can’t get that work either because the same natural account relating to non-professional staff also are used for professional staff and we need to report by department on the reporting tree. Please help! Thanks.

Simon N April 17, 2009 at 11:06 am

Thanks Jeff. I have an additional 5 columns but it works. Now one more thing, I am learning as I go with this system so bear with me. I have never used it. Well, I created a Statement of Cash Flow. Everything works fine except for the YTD column. I can not figure out how to get this to show the 2009 beginning balance for cash. I know how to generate the number but that’s all I can do. I don’t know how to carry it over the report where I want it. My current period cash is right.

Marina Peterson March 31, 2010 at 6:50 pm

I have been trying all day to get the ABS function to work in an IF CALC column. Here are the statements I have tried.

IF ABS(G-H)>2500 THEN G-H This is how it is in the book, but doesn’t work
IF (ABS(G-H))>2500 THEN G-H
IF ABS(G-H) > 2500 THEN G-H
IF ABS (G-H)>2500 THEN G-H

None work. What is the correct syntax, spacing, round or square brackets to get this working? If I can get the ABS to work, then hopefully, I will be able to build upon the variances to include % as well (Jeff’s 3/2009 posting)

Manny Chundi September 29, 2010 at 4:15 pm

Awesome tips. I have a question though. Is it possible to use the row code or the account number in an “IF THEN ELSE” calculation in a column layout. Or is there any way to achieve this effect. I have a single column that displays percentages.

1. For each of the sales rows, % is calculated as a % of total sales. I can use CBR to accomplish this.

2. For COGS, % in each row is calculated as a fraction of the corresponding sales account.
For eg, widget COGS/Widget Sales, Tool COGS/Tool Sales and so on.

Basically, I am looking to change the column calculation based on the 1. Either the row code, or 2. the account number.

Put another way, can the IF statement be used to compare the value in the column with a string? Eg. IF B=”144401″ THEN B ELSE C.
Thanks

Jan Harrigan CPA September 30, 2010 at 1:47 pm

Technically you can combine a column letter with a row code (but not B=”144401″), but that’s not the best design in this instance.

What you can do is change the base row CBR several times in the row format so that you end up with multiple CBRs. So the first CBR references total sales, then when you get to COGS, add a CBR for widget sales right above widget COGS, then a CBR for tool sales right above tool COGS. And so on.

I did a report for a hotel once that had almost as many CBRs as there were rows. :)

BTW I usually style CBR rows as italics so the row is easier to follow. I do the same with other NP rows. (A CBR row doesn’t print by default.) Cheers…Jan

Manny Chundi September 30, 2010 at 3:17 pm

Awesome idea. Thank you very much. You just made my day. :-)

Jan Harrigan CPA October 1, 2010 at 9:51 am

Happy to hear it!!!

Ali November 10, 2010 at 12:56 pm

Hello
I am trying to use SUMIF formula in FRx, but to no avail. Can we even use it in FRx…

Thanks in advance…

Jan Harrigan CPA November 10, 2010 at 7:02 pm

No…I wish! Jan

Kris Sundberg January 13, 2011 at 12:26 pm

Great Thread! I was wondering if it was possible to reference the Base Period of a report in the row. I’d like to use the If/then statement to determine whether to pull a year over year growth based on a budget, or based on the actuals for a report that shows 24 months of data through dec 2011

Jan Harrigan CPA January 13, 2011 at 12:35 pm

Thanks! No re referencing the base period in the row, but you might try a search re ‘average headcount’ for some information on dividing by the period number.

Debbie January 18, 2011 at 2:27 pm

I have a comparatve statement that was created in FRX. I want to Sbutract this years column from prior year column if the account number is >= 40000 and =”40000″ and b<= "49999" then c-e else e-c. Can this be done? It does not seem to be working.

Jan Harrigan CPA January 18, 2011 at 2:59 pm

The bad news is that what you’re trying can’t be done because the account number field is not a numeric field.

But I’m guessing you’re trying to flip signs in the revenue section. If so, the good news is that there’s a much easier way than if/then/else. See the 3 tricks are in the ‘budget variance’ section of my post on top 12 FRx tricks. Do a search (on this site) and you’ll see exactly what to do.

Robby February 3, 2011 at 1:28 pm

I’m attempting to add a few column’s to my income statement that will look at the actual vs. budget variance column, compare it to a variance threshold, then return a “yes” if the variance is exceeded.

IF ABS P>50000 THEN P ELSE 0

Thought this would be simple, but its not working out.

I also wanted to have a column that looked a % variance column and returned a “yes” if the % variance exceeded 10%.

IF ABS P>50000 THEN P ELSE 0

This doesn’t work either.

Do I need to make adjustments to my rows??

Any help would be much appreciated!

Jan Harrigan CPA February 4, 2011 at 12:44 pm

Don’t think you can return a “yes” but you can return the amount which is what you’re doing above. You might try this instead of the ‘abs’:
if p < -50000 or p > 50000 then p else 0

Grant July 5, 2011 at 6:19 pm

Hi There
I am using unit accounts in a report that has both MTD column and a calculation that adds up each period 1-12 to get a correct YTD number (exchange issues).
The issue I am having is that some units accounts are regular i.e. add up periods 1-12 for a total YTD unit while other unit accounts are non-cumulative (each month stands alone).
Can you think of a way to identify certain rows as non-cumulative and have the MTD figure appear in the YTD Calculation column?
Hope that makes sense.
Grant

Jan Harrigan CPA July 7, 2011 at 9:12 am

It sounds an awful lot like you need to use column placement. There may be an easier way, but I’d have to see what you’re doing to tell for sure. Good luck!

Grant October 5, 2011 at 5:15 pm

Hi Jan
I am looking for a way to 2 columns MTD and YTD in dollars and beside It I would like to calculate a unit cost….for example
Column B=MTD$, Column C=YTD$, Column D=MTDUnit$, Column E=YTDUnit$.
I have been able to get the desired result by using column references on separate lines….line 100 shows values pulled from the GL in column B and C and line 130 shows calculated values in columns. I would like to combine the 2 rows into one but if I use a regular calculation it just combines the total cost and the unit cost together.
Any ideas?
Thanks
Grant

Lindsay February 13, 2012 at 11:51 am

Can this calculation be used on rows that are linked to the General Ledger?

Or do I need to insert another row referencing the GL balance to use the IF THEN calculation and mark the row linked to the General Ledger not to print?

Thanks,
Lindsay

Jan Harrigan CPA February 15, 2012 at 7:23 pm

Yes you need a CAL row and you’ll use the @ symbol to reference the row codes.

Dandy Kopelang March 13, 2012 at 8:43 am

I might sound to be out of the topic, is there anywhere on the web one can get free *.pdf guide of Frx Report Designer with formulas and guides on how to do some of the reports. I need to take the certification exam but I need like a strong material that i can use. Thank you

Jan Harrigan CPA March 13, 2012 at 9:24 am

Hi Dandy…I have 2 self-study step by step training manuals that walk you through several reports, but they aren’t free:
http://www.frxbuzz.com/frx-training-manuals/

But given FRx’s future, not sure I’d spend time on it to get certified. In any event, good luck. Jan

Patty Brown March 26, 2012 at 9:37 am

Jan,

It’s me again. Love the reference guides but I am having a bit of a problem with using the if then else calculationf for my intercompany accounts. I have several intercompany accounts in each of my companies. I pulled the balances of each in a separate section in my row definitions and now I am trying to use the if then cal to pull the correct balances in the receivable/payable sections on my balance sheet. I get it to work for one company but can’t figure out how to add multiple if then statements on the same row. Is this possible? Or do I need to have separate rows that do not print or show on the balance sheet that sum up to the proper line?

Jan Harrigan CPA April 12, 2012 at 6:21 pm

Hi Patty…yes to the latter! Good luck…Jan

Rob April 23, 2012 at 8:36 am

Great thread! Here’s another scenario I haven’t seen discussed. What about displaying or suppressing a row based on the date of a column. For example, a rolling P&L that uses a non-financial account value, but that value didn’t exist until a particular month. I didn’t see any discussion where the true/false statement tested on all columns in the Column Layout. Thanks for any feedback!

Jan Harrigan CPA May 4, 2012 at 10:50 am

Hi Rob…unless I’m missing something, it doesn’t sound like you’d need an if/then because FRx picks up non-financial accounts just like it would a regular account: whatever value is there for a particular period is what gets presented. Cheers…Jan

Adam May 9, 2012 at 9:12 am

Been reading up on if then else statements and I have a question. I have a column that is a variance against budget and another for last year. Let’s say A is actual, B is budget and C is variance. For D I want the percentage variance so I’ve used if B>0 then C/B else 0. Works great, problem is formatting in the rows is overriding the display zeros as blanks on the print out. Can I fix this or can I point the else statement to display N/A in text?

Logan May 16, 2012 at 4:42 pm

Hi
Great Frx site .I have a small problem in frx whereby i am trying to restrict zero balances .I have used account filters for departments and one department i am using opening balance as well as current transactions combined .i need to exclude transaction balances .Basically if the closing balance is zero , i dont want it to print .Is there a formula (If,Then ,Else statement) i can use to suppress this?

Thanks
Logan

Jan Harrigan CPA May 17, 2012 at 9:02 am

Hi Logan…in Report Options > Formatting, make sure the box “Display rows with no amounts” is unchecked. This is the default setting, so that FRx doesn’t print an account when the calculated amount is zero.

Ito May 18, 2012 at 9:37 am

I need to Calculate a CGR (but for months except of years), it seems that Management reporter 2.0 does not accept the ^ operator.
CGR = ((End Value/StartValue)^(1/BASE-1))-1

CGR = Compound Growth

Leave a Comment

Previous post:

Next post: