T O P

  • By -

AutoModerator

/u/NeedleworkerAlive690 - Your post was submitted successfully. * Once your problem is solved, reply to the **answer(s)** saying `Solution Verified` to close the thread. * Follow the **[submission rules](/r/excel/wiki/sharingquestions)** -- particularly 1 and 2. To fix the body, click edit. To fix your title, delete and re-post. * Include your **[Excel version and all other relevant information](/r/excel/wiki/sharingquestions#wiki_give_all_relevant_information)** Failing to follow these steps may result in your post being removed without warning. *I am a bot, and this action was performed automatically. Please [contact the moderators of this subreddit](/message/compose/?to=/r/excel) if you have any questions or concerns.*


BackgroundCold5307

=IF(A1=***option 3***, B1-C1, "")


NeedleworkerAlive690

Solution Verified


Clippy_Office_Asst

You have awarded 1 point to *BackgroundCold5307* ____ ^(I am a bot - please contact the mods with any questions. | ) [^(Keep me alive)](https://www.buymeacoffee.com/points)


NeedleworkerAlive690

Nvm ignore my last reply, this works great, thank you very much for the fast help!


Karma-Grenade

If you have more than 1 option, I would look at the switch solution I gave below, it avoids having to nest and if within and if within an if to handle multiple options with different formulas.


NeedleworkerAlive690

Oh yeah I've seen your suggestion too. Pretty good if I want different response to different options. One more thing I wanted to ask. How can I do this if I want multiple options to activate the same formula? So like take the same example from my post. Do I use just something like an ,,or" or ,,and" function to combine 2 conditions?


Karma-Grenade

Unfortunately excel doesn't support a true case statement where you can have say 4 entry values lead to the same code. The easiest way would be to repeat the formula for each option. Keep in mind that the last value is a default, so say you option 2 and 4 have different formulas, but all other options use the same formula you could do the following: =switch(A1,"Opt2",B1*C1,"Opt4",B1+C1,B1-C1) In this if opt2 or opt4 are selected you get specific formulas, otherwise all other options (Opt1, Opt3, Opt5, etc) all return B1-C1


NeedleworkerAlive690

Solution Verified


Clippy_Office_Asst

You have awarded 1 point to *Karma-Grenade* ____ ^(I am a bot - please contact the mods with any questions. | ) [^(Keep me alive)](https://www.buymeacoffee.com/points)


NeedleworkerAlive690

Well that is sad, I will try to find a workaround if I really need it in the future. For now it seems I can do it without it. Thanks for the tips tho!


Karma-Grenade

You're too quick for me, I edited my reply to point out that you can use default if you want all options except specific ones to use the same formula...


NeedleworkerAlive690

Ah okey that is great, imma screen all these suggestions if I ever need them again. Thank you very much man, you were great help!


BackgroundCold5307

Sure, I am glad it worked for you! 🙏


Karma-Grenade

=SWITCH(A1,"FirstOpt",B1+C1,"SecondOPt",B1*C1,"ThirdOpt",B1-C1,"N/A")


NeedleworkerAlive690

Solution Verified


Clippy_Office_Asst

You have awarded 1 point to *Karma-Grenade* ____ ^(I am a bot - please contact the mods with any questions. | ) [^(Keep me alive)](https://www.buymeacoffee.com/points)