nested IF statements in a cash flow model

dmcelrath

New Member
Joined
Feb 27, 2018
Messages
6
I am building a cash flow model to determine my IRR depending on when I sell the investment.

The logic I am trying to follow for the equation is:
  • If current period is equal to harvest period, then populate the cell with the sell price minus the cash outflow for that period.
  • If current period is greater than harvest period, then populate the cell with 0.
  • If current period is less than harvest period, then populate the cell with the cash outflow for that period.

My Harvest Period is cell B11
My Current Period row ranges from 0:17 which equates to cells E2:V2
My cash flow if current period = harvest period ranges from E11:V11
My cash flow if current period > harvest period ranges from E12:V12
My cash flow if current period < harvest period ranges from E10:V10

(I only created these individual rows calculating my cash flow for each scenario for each period bc my equations were getting lengthy and I was trying to simplify the equation for troubleshooting)

My equation for Current Period 0 is: =IF($B$11=E2,E11,IF($B$11<E2,E12,E10))

I then copy and paste this into my subsequent periods.

What happens is I have my Harvest Period set at 4, and the equation works for Periods 0:4, then pulls 0 for Periods 5:9 like it should, but when I get to Periods 10:17 it pulls the value from row 10 like the current period < harvest period.

I've tried all sorts of things trying to figure this out and don't know what to do!

Can someone please help me?

I am happy to share the spreadsheet if that would make it easier, I just need some guidance on how to do that.
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
Hi,

Place a space before and after all your < and > symbols in the formula for it to show properly.
 
Upvote 0
Sorry, not following your description to the formula.
Can you post a few lines of sample data and expected results with description.
 
Upvote 0
Harvest Period (HP)4
Current Period (CP)0123456...1011
CF if CP < HP0
-26216-26610-27018-27444-27887-28348...-30388-30951
CF if CP = HP0-23934-17326-10568-3662338710573...2682230747
CF if CP > HP0000000000
CF per period0-26216-26610-27018-3662000-30388-30951

<tbody>
</tbody>


The equation I posted is being used in the "CF per period" row. The expected result is correct for periods 0-9, the problem is from period 10 and on. The "CF per period" for these periods should be 0, not the value in that period's "CF if CP < HP" row.
 
Upvote 0
I'm not getting the error you're getting...
How is B11 and E2:V2 populated, manually or by formula, I suspect leading and/or trailing spaces...


Book1
BCDEFGHIJKLMNOP
201234567891011
9
10Harvest PeriodCurrent02621626610270182744427887283483038830951
114Current=Harvest0239341732610568-36623387105732682230747
12Current>Harvest000000000
13
14CF per Period0262162661027018-36620000000
Sheet10
Cell Formulas
RangeFormula
E14=IF($B$11=E2,E11,IF($B$11))
 
Upvote 0
Seems to be working now. E2:V2 had error flags bc they were "numbers stored as text" and when I made the suggested correction from Excel everything was fixed.

Thanks for the help!
 
Upvote 0

Forum statistics

Threads
1,215,607
Messages
6,125,818
Members
449,262
Latest member
hideto94

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top