How to Spill a nested IF equation

PrettyGood_Not Great

Board Regular
Joined
Nov 24, 2023
Messages
93
Office Version
  1. 365
Platform
  1. Windows
Hi,

I have the following algorithm comprised of mostly nested IF. I am struggling to upgrade this to a 365 solution that will allow the equation to spill.

=IF($D11>=FcstMonth,IF(O$10>=$D11,IF(O$10<=$E11,$F11*O$9/SUM(XLOOKUP($D11,$O$10:$BF$10,$O$9#):XLOOKUP($E11,$O$10:$BF$10,$O$9#)),""),""),IF(O$10>=FcstMonth,IF(O$10<=$E11,$F11*O$9/SUM(XLOOKUP(FcstMonth,$O$10:$BF$10,$O$9#):XLOOKUP($E11,$O$10:$BF$10,$O$9#)))))

I don't expect anyone to come back with a working example to this puppy, just looking for any known approaches to handling the series of nested if. When I set all of the vertical references to spill (i.e. $D11# etc), I get a #VALUE.
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
It would be helpful if you can post some sample data rather just a formula using XL2BB.
 
Upvote 0
Maybe
Excel Formula:
=BYROW(D11:F11#,LAMBDA(br,IF(INDEX(br,,1)>=FcstMonth,IF(O$10>=INDEX(br,,1),IF(O$10<=INDEX(br,,2),INDEX(br,,3)*O$9/SUM(XLOOKUP(INDEX(br,,1),$O$10:$BF$10,$O$9#):XLOOKUP(INDEX(br,,2),$O$10:$BF$10,$O$9#)),""),""),IF(O$10>=FcstMonth,IF(O$10<=INDEX(br,,2),INDEX(br,,3)*O$9/SUM(XLOOKUP(FcstMonth,$O$10:$BF$10,$O$9#):XLOOKUP(INDEX(br,,2),$O$10:$BF$10,$O$9#)))))))
 
Upvote 0
It would be helpful if you can post some sample data rather just a formula using XL2BB.
Hi Cubist, here you go. Note I have removed some of the error handling so you can better see what it's doing.

Test.xlsm
CDEFGHIJKLMNO
8Apr-24161151519537423557
9ETC188143143180150143180150120173
10TBA StartFinishTBAApr-24May-24Jun-24Jul-24Aug-24Sep-24Oct-24Nov-24Dec-24Jan-25
11Jan-24Jan-250.10.00.00.00.00.00.00.00.00.00.0
12Jan-24Jan-250.60.10.10.10.10.10.10.10.10.00.1
13Jan-24Jan-250.60.10.10.10.10.10.10.10.10.00.1
14Jan-24Jan-250.60.10.10.10.10.10.10.10.10.00.1
15Jan-24Jan-25          
16Jan-24Apr-24 FALSEFALSEFALSEFALSEFALSEFALSEFALSEFALSEFALSE
17Jan-24Sep-24      FALSEFALSEFALSEFALSE
18Jan-24Apr-2439.439.4FALSEFALSEFALSEFALSEFALSEFALSEFALSEFALSEFALSE
19Jan-24Jan-257.40.90.70.70.80.70.70.80.70.60.8
20Jan-24Sep-2418.93.82.92.93.63.02.9FALSEFALSEFALSEFALSE
21May-24Jul-240.3 0.10.10.1      
22Sep-24Nov-2491.1     27.534.728.9  
23Sep-24Jan-257.6     1.41.81.51.21.7
24Jan-24Apr-2415.015.0FALSEFALSEFALSEFALSEFALSEFALSEFALSEFALSEFALSE
SEM
Cell Formulas
RangeFormula
F8:O8G8=SUM(G11:G32)
F9:AW9F9=IF(F$10:AW$10="","",XLOOKUP(TEXT(F$10:AW$10,"mmm"),Monthlist,Hourlist))
F10:P10F10=TOROW(DATE(YEAR(FcstMonth),SEQUENCE(DATEDIF(FcstMonth,ProjFinsh,"m")+1,1,MONTH(FcstMonth),1),1))
F11:O24F11=IFERROR(IF($C11<>"",IF(G$10<>"",IF($C11>=$C$8,IF(F$10>=$C11,IF(F$10<=$D11,$E11*F$9/SUM(XLOOKUP($C11,$F$10:$AW$10,$F$9#,""):XLOOKUP($D11,$F$10:$AW$10,$F$9#,"")),""),""),IF(F$10>=$C$8,IF(F$10<=$D11,$E11*F$9/SUM(XLOOKUP($C$8,$F$10:$AW$10,$F$9#):XLOOKUP($D11,$F$10:$AW$10,$F$9#))))))),"")
Dynamic array formulas.
 
Upvote 0
Maybe
Excel Formula:
=BYROW(D11:F11#,LAMBDA(br,IF(INDEX(br,,1)>=FcstMonth,IF(O$10>=INDEX(br,,1),IF(O$10<=INDEX(br,,2),INDEX(br,,3)*O$9/SUM(XLOOKUP(INDEX(br,,1),$O$10:$BF$10,$O$9#):XLOOKUP(INDEX(br,,2),$O$10:$BF$10,$O$9#)),""),""),IF(O$10>=FcstMonth,IF(O$10<=INDEX(br,,2),INDEX(br,,3)*O$9/SUM(XLOOKUP(FcstMonth,$O$10:$BF$10,$O$9#):XLOOKUP(INDEX(br,,2),$O$10:$BF$10,$O$9#)))))))
Hi Fluff, I'll give it a shot.

Here is some extra info

Test.xlsm
CDEFGHIJKLMNO
8Apr-24161151519537423557
9ETC188143143180150143180150120173
10TBA StartFinishTBAApr-24May-24Jun-24Jul-24Aug-24Sep-24Oct-24Nov-24Dec-24Jan-25
11Jan-24Jan-250.10.00.00.00.00.00.00.00.00.00.0
12Jan-24Jan-250.60.10.10.10.10.10.10.10.10.00.1
13Jan-24Jan-250.60.10.10.10.10.10.10.10.10.00.1
14Jan-24Jan-250.60.10.10.10.10.10.10.10.10.00.1
15Jan-24Jan-25          
16Jan-24Apr-24 FALSEFALSEFALSEFALSEFALSEFALSEFALSEFALSEFALSE
17Jan-24Sep-24      FALSEFALSEFALSEFALSE
18Jan-24Apr-2439.439.4FALSEFALSEFALSEFALSEFALSEFALSEFALSEFALSEFALSE
19Jan-24Jan-257.40.90.70.70.80.70.70.80.70.60.8
20Jan-24Sep-2418.93.82.92.93.63.02.9FALSEFALSEFALSEFALSE
21May-24Jul-240.3 0.10.10.1      
22Sep-24Nov-2491.1     27.534.728.9  
23Sep-24Jan-257.6     1.41.81.51.21.7
24Jan-24Apr-2415.015.0FALSEFALSEFALSEFALSEFALSEFALSEFALSEFALSEFALSE
SEM
Cell Formulas
RangeFormula
F8:O8G8=SUM(G11:G32)
F9:AW9F9=IF(F$10:AW$10="","",XLOOKUP(TEXT(F$10:AW$10,"mmm"),Monthlist,Hourlist))
F10:P10F10=TOROW(DATE(YEAR(FcstMonth),SEQUENCE(DATEDIF(FcstMonth,ProjFinsh,"m")+1,1,MONTH(FcstMonth),1),1))
F11:O24F11=IFERROR(IF($C11<>"",IF(G$10<>"",IF($C11>=$C$8,IF(F$10>=$C11,IF(F$10<=$D11,$E11*F$9/SUM(XLOOKUP($C11,$F$10:$AW$10,$F$9#,""):XLOOKUP($D11,$F$10:$AW$10,$F$9#,"")),""),""),IF(F$10>=$C$8,IF(F$10<=$D11,$E11*F$9/SUM(XLOOKUP($C$8,$F$10:$AW$10,$F$9#):XLOOKUP($D11,$F$10:$AW$10,$F$9#))))))),"")
Dynamic array formulas.
 
Upvote 0
Maybe
Excel Formula:
=BYROW(D11:F11#,LAMBDA(br,IF(INDEX(br,,1)>=FcstMonth,IF(O$10>=INDEX(br,,1),IF(O$10<=INDEX(br,,2),INDEX(br,,3)*O$9/SUM(XLOOKUP(INDEX(br,,1),$O$10:$BF$10,$O$9#):XLOOKUP(INDEX(br,,2),$O$10:$BF$10,$O$9#)),""),""),IF(O$10>=FcstMonth,IF(O$10<=INDEX(br,,2),INDEX(br,,3)*O$9/SUM(XLOOKUP(FcstMonth,$O$10:$BF$10,$O$9#):XLOOKUP(INDEX(br,,2),$O$10:$BF$10,$O$9#)))))))
Hi Fluff, this was the approach I was looking for (D11:F11# etc) so thanks for this. It is returning a #REF however. Calculation steps are not providing much insight. It shows a "BYROW(#REF,#VALUE)"
 
Upvote 0
Are D11, E11 & F11 all spill ranges that spill the same number of rows?
 
Upvote 0
Are D11, E11 & F11 all spill ranges that spill the same number of rows?
D11 and E11 are named ranges of the same dimension. F11 is a calculation of it's own, but it uses named ranges that are the same dimension as D and E, so I think it's safe to say yes to all.
 
Upvote 0
D11 and E11 are named ranges of the same dimension. F11 is a calculation of it's own, but it uses named ranges that are the same dimension as D and E, so I think it's safe to say yes to all.
On further inspection, F11 is calculating with a couple named ranges of small dimension that D and E. So this could be the problem array?
 
Upvote 0
If they are named ranges, then that is the reason. Try it like
Excel Formula:
=BYROW(D11:F24,LAMBDA(br,IF(INDEX(br,,1)>=FcstMonth,IF(O$10>=INDEX(br,,1),IF(O$10<=INDEX(br,,2),INDEX(br,,3)*O$9/SUM(XLOOKUP(INDEX(br,,1),$O$10:$BF$10,$O$9#):XLOOKUP(INDEX(br,,2),$O$10:$BF$10,$O$9#)),""),""),IF(O$10>=FcstMonth,IF(O$10<=INDEX(br,,2),INDEX(br,,3)*O$9/SUM(XLOOKUP(FcstMonth,$O$10:$BF$10,$O$9#):XLOOKUP(INDEX(br,,2),$O$10:$BF$10,$O$9#)))))))
 
Upvote 0
Solution

Forum statistics

Threads
1,215,201
Messages
6,123,617
Members
449,109
Latest member
Sebas8956

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