Very tricky problem, can anyone help?

excelos

Well-known Member
Joined
Sep 25, 2011
Messages
591
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

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
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,215,669
Messages
6,126,125
Members
449,293
Latest member
yallaire64

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