Struggling with IFs

LucreMoneyWonga

New Member
Joined
May 22, 2023
Messages
10
Office Version
  1. 365
Platform
  1. Windows
Hi, I am pretty new to Excel and am trying to create a macro to provide the risk bracket (difference between two share prices) for some analysis I am doing.
I currently have two formulas that work perfectly, but I enter them separately depending on the direction of the share price movement.

I enter "S" or "L" for a short or long price difference (short meaning down, long meaning up). I then have two numbers representing the top and bottom of the price range.
I use this formula if the price is going down (S11 and Y11 being the prices in question)

=IF(Q11="S",S11-Y11)

and change it to this formula if the price is going up (note the pricing cells have changed places, as I don't want a negative number returned)

=IF(Q16="L",Y11-S11)

My question is can I combine these formulas so I can just use one formula and copy it down the spreadsheet, and if so, can I enter a third condition where "N/A" is returned if there is no price change, rather than 0 ?

Thanks very much for any help
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
Assuming no change means that Q11 is neither S nor L, you could use:

Excel Formula:
=IF(Q11="S",S11-Y11,IF(Q16="L",Y11-S11,"N/A"))
 
Upvote 0
Solution
Assuming no change means that Q11 is neither S nor L, you could use:

Excel Formula:
=IF(Q11="S",S11-Y11,IF(Q16="L",Y11-S11,"N/A"))
Thx very much, had my brackets, comma's in the wrong places, much appreciated.
 
Upvote 0
Glad we could help, and welcome to the forum! :)
 
Upvote 0

Forum statistics

Threads
1,215,222
Messages
6,123,706
Members
449,118
Latest member
MichealRed

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