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

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.

LMaeExcel

New Member
Joined
Jan 3, 2017
Messages
14
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

jimrward

Well-known Member
Joined
Feb 24, 2003
Messages
1,816
Office Version
  1. 2016
  2. 2013
  3. 2011
  4. 2010
  5. 2007
Platform
  1. Windows
Are you always adding 2 to the end of 2 character strings

If so, try, =IF(LEN(A1)=2,A1&"2",A1)
 
Upvote 0

LMaeExcel

New Member
Joined
Jan 3, 2017
Messages
14
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

T. Valko

Well-known Member
Joined
May 9, 2009
Messages
16,623
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,191,003
Messages
5,984,109
Members
439,872
Latest member
noaman79

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
Top