Forum Discussion
meg_89
Sep 12, 2022Copper Contributor
IF Statements - multiple criteria
I am trying to create IF statements that I can then add conditional formatting to colour code.
This is what I has so far but I cannot figure the rest out.
=IF(N2>G2,"Over-Min",IF(N2<G2,"Order",IF(P2=N2=G2,"On Order",IF(N2=G2,"Min"))))
I need to compare N2(latest count) to G2(min) but also to the previous count columns.
So if the latest count is below min I need to "order"
If the latest count is below min but also the same as the last count(P2, R2, T2,V2 and so on) I need it to say "on order"
But if the count and min (N2 and G2) are the same I need it to say "Min"
I am having trouble with it reading min when it should be on-order and vice versa,
Below the status should be "on-order"
Min | Status | LATEST COUNT | LATEST COUNT DATE | COUNT | DATE | COUNT | DATE | COUNT | DATE | COUNT | DATE |
10 | Order | 8 | 12-Sep | 8 | 05-Sep | 10 | 29-Aug | 10 | 22-Aug | 10 | 15-Aug |
- PeterBartholomew1Silver Contributor
The expression
= (P2=N2=G2)
is very unlikely to be what you require. Excel evaluates it left to right, first checking to see whether P2=N2 (returns TRUE or FALSE), then tests the result for equality with G2 (a count). I am rather guessing your requirement, but it may be something like
= IF(latestCount>Min,"Over-Min", IF(latestCount<Min,"Order", IF((latestCount=Min), IF(MIN(INDEX(datedCounts,{1,3,5,7}))=latestCount, "On Order", "Min" ) ) ) )
- meg_89Copper Contributor
Thank you, I ended up creating another column with a formula to pull from instead.