Excel - if cell contains..

77winston

New Member
Joined
Sep 11, 2013
Messages
31
Office Version
  1. 2013
Platform
  1. Windows
Hi, Hope someone can assist with this one.
I have a spreadsheet with column A containing series of email addresses, in the column B I'd like to assign a value based on email domain in Column A.
I tried the below forumla and it works, but stuck on how to extend it so it will cater for all domain variations.
=IF(ISNUMBER(SEARCH("gmail",A3)),"Segment2","")
Values to assign for domains are
Assignments
DomainsSegment
hotmailsegment 1
gmailsegment 2
yopsegment 3
yahoosegment 4


Sample of expected result


Hope it makes sense.
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
Upvote 0
Could you construct a lookup table and then use a formula like this?

23 03 10.xlsm
ABCDE
1Email_AddressSegmentsDomainsSegment
2test.test@gmail.comsegment 2hotmailsegment 1
3test@yop.comsegment 3gmailsegment 2
4tester@yahoo.comsegment 4yopsegment 3
5testing@hotmail.comsegment 1yahoosegment 4
Domain
Cell Formulas
RangeFormula
B2:B5B2=VLOOKUP(REPLACE(LEFT(A2,FIND(".",A2,FIND("@",A2))-1),1,FIND("@",A2),""),D$2:E$5,2,0)
Awesome! Did not think of this approach. Will try it out.
Thank you.
 
Upvote 0
Cheers. Let us know (with examples) if it does not meet your need.
 
Upvote 0

Forum statistics

Threads
1,223,894
Messages
6,175,252
Members
452,623
Latest member
Techenthusiast

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