Very tricky problem, can anyone help?

excelos

Well-known Member
Joined
Sep 25, 2011
Messages
592
Office Version
  1. 365
Platform
  1. Windows
Hello!

Code:
=IF(AND(D15>=$J26,D15<$J26+7),$G26,IF(D15>$J26,INDEX($H$38:$H$136,COLUMNS($D$16:D16)),0))

If the date D15 is within the range AND(D15>=$J26,D15<$J26+7), then fill the cell with $G26.
If the date D15 is outside the above range, and it is lower than $J26, then fill the cell with 0.
If the date D15 is outside the above range, and it is greater than $J26, then fill the subsequent cells with the values from another range ($H$38:$H$136) one by one.

However, I cannot get right that last bit. I cannot find how to make the formula know when to start filling the values from the other range.
The COLUMNS($D$16:D16)) is not correct, but I don't know what to replace it with. It should start with 1 and grow to 2, 3, etc, but I don't know how the formula will remember that the previous value of it was 2, 1, etc.

Any idea?

It's so tricky!

Thanks
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
I am thinking to have another IF condition to check the previous value, but how can I make it remember that cell and start the COLUMNS counting?

Thanks!
 
Last edited by a moderator:
Upvote 0
I came up with this:

Code:
=IF(AND(D15>=$J26,D15<$J26+7),$G26,IF(D15>$J26,INDEX($H$38:$H$136,COLUMNS(INDEX($D16:$AN16,1,MATCH($G26,$D16:$AN16,1):D16),0),0))


But it says 'we found a problem with this formula'. I did try to enter it as array formula.

Any hint?
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,824
Messages
6,181,187
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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