Forum Discussion
Budgen
Nov 02, 2022Copper Contributor
IF to check multiple cells and formula for each depending on result
Hi all, So the use for this is a trade journal. You take a trade/position, it has 3 take profits which close a % of the trade. The cell I'm trying to create is a Stop loss. How big the position c...
- Nov 02, 2022
Here's the formula:
=IF(I2="",O2*1,IF(K2="",O2*0.8,IF(M2="",O2*0.4,O2*0.2)))
You might also see it written like:
=IF(ISBLANK(I2),O2*1,IF(ISBLANK(K2),O2*0.8,IF(ISBLANK(M2),O2*0.4,O2*0.2)))
Patrick2788
Nov 02, 2022Silver Contributor
I strongly recommend using the function arguments menu when getting started with logical formulas (It's a big help with IF-OR and IF-AND, especially). It will help you step through the arguments and avoid errors.
As you can see from above, the first logical test results in TRUE, so Excel will go to the Value if True (Box) but it doesn't understand *1 because the * is a multiplier.
What would you like to do for these bolded parts? Do you need to multiply those percentages by the value in a cell?
=IF(I2="",*1,IF(K2="",*0.8,IF(M2="",*0.4,"",*0.2,)))
- BudgenNov 02, 2022Copper ContributorBrilliant break down I appreciate you taking the time, I didn't even know that existed. Bear with me having such little understanding.
That's correct, * all by the value in cell O2.- Patrick2788Nov 02, 2022Silver Contributor
Here's the formula:
=IF(I2="",O2*1,IF(K2="",O2*0.8,IF(M2="",O2*0.4,O2*0.2)))
You might also see it written like:
=IF(ISBLANK(I2),O2*1,IF(ISBLANK(K2),O2*0.8,IF(ISBLANK(M2),O2*0.4,O2*0.2)))
- BudgenNov 02, 2022Copper ContributorThat's spot on. Thanks for that Patrick, much appreciated!