Forum Discussion
tsbarton70
Feb 06, 2026Copper Contributor
Stacked Excel Formula
Hello everyone. I've spent the past 2-3 hours trying to figure this out on my own without luck. What I'm needing is a formula that will check D11 (highlighted) to make sure that it's within the param...
m_tarler
Feb 06, 2026Bronze Contributor
So the problem is you need to actually write a simple parser to interpret that second line. Here is an example that can do that:
=LET(in,D11:I12,
checks, BYCOL(in,LAMBDA(c, IF(N(INDEX(c,1)),LET( val, INDEX(c,1), crit, INDEX(c,2),
compare, SWITCH(LEFT(crit,1), "<",-2,"≤",-1,"=",0,"≥",1,">",2,3),
value, --MID(crit,2,SEARCH(" ",crit)-2),
--CHOOSE(compare+3, val>=value, val>value, val<>value, val<value, val<=value, 0)),0))),
SUM(checks))Alternatively you can take the above code and make a LAMBDA function out of it so each cell in K would need a very simple formula. So lets call it "FAILS". So in the Name Manager (on the 'Formulas' ribbon) click NEW and then enter FAILS as the name and then the following formula in the Refers To: box
=LAMBDA(in, SUM(BYCOL(in,LAMBDA(c, IF(N(INDEX(c,1)),LET( val, INDEX(c,1), crit, INDEX(c,2), compare, SWITCH(LEFT(crit,1), "<",-2,"≤",-1,"=",0,"≥",1,">",2,3), value, --MID(crit,2,SEARCH(" ",crit)-2), --CHOOSE(compare+3, val>=value, val>value, val<>value, val<value, val<=value, 0)),0)))))it is essentially the same as the above but not defining that range D11:I12 and will now let you enter it like a formula. so now in K11 you just enter:
=FAILS(D11:I12)
and voila