IF AND CONTAINS formula

jackthompson

New Member
Joined
Jun 4, 2015
Messages
7
Hi,

I have a pivot table in excel.

I want to be able to make a new column at the end with the result of this.

I just cant figure the formula out.

for example

I need it to look at Cell J2 and if J2 contains "Premium" then Say Premium AND if it contains "Advanced" then say Advanced.

Possible?
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
Hi,

I have a pivot table in excel.

I want to be able to make a new column at the end with the result of this.

I just cant figure the formula out.

for example

I need it to look at Cell J2 and if J2 contains "Premium" then Say Premium AND if it contains "Advanced" then say Advanced.

Possible?
Hi JackThompson, welcome to the boards.

I assume despite your original post J2 will not have Premium AND Advanced, but rather Premium OR Advanced. If that is correct try this formula:

=IF(OR(ISNUMBER(SEARCH("premium",J2))),"Premium",IF(OR(ISNUMBER(SEARCH("advanced",J2))),"Advanced",""))
 
Last edited:
Upvote 0
Hi JackThompson, welcome to the boards.

I assume despite your original post J2 will not have Premium AND Advanced, but rather Premium OR Advanced. If that is correct try this formula:

=IF(OR(ISNUMBER(SEARCH("premium",J2))),"Premium",IF(OR(ISNUMBER(SEARCH("advanced",J2))),"Advanced",""))

Absolutely perfect!!!
 
Upvote 0
If you're going to have more than just a couple key words to look for, try putting a list of those keywords in a range of cells.
Say N2:N3 (N2 = Premium, N3 = Advanced)

Then use
=LOOKUP(2^15,SEARCH($N$2:$N$3,J2),$N$2:$N$3)


There cannot be any blanks in N2:N3
 
Upvote 0
actually... how , if possible, do you add an ELSE function so that everything other than those 2 criteria, will equal lets say "Other"
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,326
Members
452,635
Latest member
laura12345

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