IF Then - Mulitple Conditions

LMaeExcel

New Member
Joined
Jan 3, 2017
Messages
14
Hello! I am hoping for some help with an If Then formula or possibly another formula that will accomplish the below:

I'd like the formula to check for multiple conditions, such as:
If B2 = "MI" then say "MI2" in this cell, or if B2 = "NY" then say "NY2" in this (same) cell, or I B2 = "FL" then say "FL2" in this (same) cell... and so on

Help is appreciated!
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
Thanks for your reply Roderick_E!!
I'm still experimenting, but I think I'm onto something. =if(A1="NY","NY2",if(A1="AZ","AZ2",if(A1="MI","MI2"," "))) Seems to be working so far, but I'll try yours out too and see if that also works.
 
Upvote 0
Are you always adding 2 to the end of 2 character strings

If so, try, =IF(LEN(A1)=2,A1&"2",A1)
 
Upvote 0
jimrward, that did it! Thank you! The formulas above were working, but as I continued to include 50+ scenarios, it stopped working when it reached a certain length.
Simple and worked awesome!
 
Upvote 0
Are you always adding 2 to the end of 2 character strings

If so, try, =IF(LEN(A1)=2,A1&"2",A1)
You don't need to use quotes around the number 2.

=IF(LEN(A1)=2,A1&2,A1)

The only time you'd need to quote numbers is if it's a string of numbers starting with a leading 0.

=IF(LEN(A1)=2,A1&"012",A1)
 
Upvote 0

Forum statistics

Threads
1,214,972
Messages
6,122,530
Members
449,088
Latest member
RandomExceller01

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