Sep 02 2022 02:51 AM
I wish to show a description next to a couple of sub-totals (e.g let us say that the sub-totals are in cells G50 & H50). I want the description in, say, cell D50 to show the wording "Profit" or "Loss" depending on whether G50 & H50 are both positive, both negative, or to show Profit/(Loss) if G50 is positive, and H50 is negative - or vice versa.
Sep 02 2022 03:01 AM
=IF(AND(G50>0,H50>0),"Profit",IF(AND(G50<0,H50<0),"Loss",IF(AND(G50>0,H50<0),"Profit/(Loss)",IF(AND(G50<0,H50>0),"(Loss)/Profit",""))))
You can apply nested IF as well. An alternative besides SWITCH could be IFS.
Sep 02 2022 03:58 AM
Sep 02 2022 04:04 AM
Alternatively
=IF(G50>0,IF(H50>0,"Profit","Profit/(Loss"),IF(H50>0,"(Loss)/Profit","Loss"))
Sep 02 2022 04:10 AM
SolutionSep 02 2022 10:15 AM
If you want a recent function
= SWITCH(
SUM((values>0)*{2,1}),
3, "Profit",
2, "Profit/(Loss)",
1, "(Loss)/Profit",
"(Loss)"
)
Sep 02 2022 04:10 AM
Solution