Nested Countif in Vlookup is rejected by Excel...

Darchcruise

New Member
Joined
Jun 3, 2011
Messages
8
Hello,

I created a excel sheet (Sheet 2)that acts like MS PROJECT in that it looks at horizontal date and then if it is larger that the (vertical) project start date, it does a VLookUp on another sheet (Sheet 1-construction project cash flow).

Sheet 2
1/30/12 2/30/12 3/30/12 ...etc
Project 1 Start Date
Project 2 Start Date
Project 3 Start Date

________________________________________________________________
(Sheet 1-construction project cash flow)

M1 M2 M3 M4 M5 M6
Project 1 Start Date CF1 CF2 CF3 CF4 CF5 CF6
Project 2 Start Date CF1 CF2 CF3 CF4 CF5 CF6
Project 3 Start Date CF1 CF2 CF3 CF4 CF5 CF6


The issue is the column index number in VLookup. I created a If statement for the column index number, that says the following statement "if the previous cell has no value give me a 2, which allows VLookup to grab the first cash flow. "If FALSE, hence, the previous cell has a value, i.e. the first cash flow is already in place, then use CountIf plus +1. I would have a 1 all the way at the begining of row so that the count if would be 2+1. This makes Vlookup's column index number a "3", which is perfect b/c that means it thakes the next cash flow in sequence (CF2). As I drag this formula the column number increases, so that I get CF3, CF4, etc..

The problem is that Excel gives me an N/A value for the nested CountIf function. It maybe possible that this is to much "logic" for excel to handle. Below is the formula:

=IF(T$4>=$E10,VLOOKUP(TEST2!$E10,'Construction CF (1)'!$E$9:$R$11,IF(S10=0,2,COUNTIF(F10:S10,">0")+1),0),0)

I know my line of thinking works because when I supplement the countif with the formula below, the cash flows work. However, it is not practical because eventually it grabs other incorrect dates (hard to expalin this part). See formula is below:

=IF(T$4>=$E10,VLOOKUP(TEST2!$E10,'Construction CF (1)'!$E$9:$R$11,IF(S10=0,2,V8+1),0),0)
________________________________________________________________
This is what I what Sheet 2 to look like. Hence CF start on the "start date":

Sheet 2
1/30/12 2/30/12 3/30/12 4/30/12 etc..
Project 1 Start Date CF1 CF2 CF3 CF4
Project 2 Start Date CF1 CF2 CF3 CF4 CF5
Project 3 Start Date CF1 CF2
Project 4 Start Date CF1 CF2 CF3

I need to figure this out ASAP. Please help

Thanks,
: )
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
Thanks- I ended up using the following function:

=IF($E8>F$4,0,OFFSET('Construction CF (1)'!$F9,0,(YEAR(F$4)-YEAR($E8))*12+(MONTH(F$4)-MONTH($E8))))
 
Upvote 0

Forum statistics

Threads
1,223,164
Messages
6,170,444
Members
452,326
Latest member
johnshaji

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