Iif portion of string exists in one cell, return corresponding column?

CalianasMamma

New Member
Joined
May 14, 2015
Messages
4
I've been trying to figure this out but I need help!

I want to associate the type of school, based on their email address. My first sheet has a list of email address.
excel_q_b.jpg


I have another sheet with a list of domains and what type of school it is. Is there a way that I can do some kind of a wildcard search to see if the email address (sheet1, columnA) contains the domain (sheet2, col A), and, if so, return the 'SchoolType' as a result?
excel_q_a.jpg


Thanks to anyone who can help me! I've been trying but the wildcard part of it really throws me off. I'm looking for case insensitive.
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
Welcome to the board.

IN the sheet with just the email addresses.
B2: =LOOKUP(2^15,SEARCH('OtherSheet'!A$2:A$6,A2),'OtherSheet'!B$2:B$6)

Note, there cannot be any blanks in OtherSheet!A2:A6
 
Upvote 0
Enter this formula in Cell B2:

=IFERROR(VLOOKUP(TRIM(RIGHT(A2,LEN(A2)-FIND("@",A2,1))),Sheet2!A:B,2,FALSE),"DOMAIN Not Found.")

Copy down to the necessary rows in Column B (Sheet1).
This will lookup the SchoolType from Sheet2. It will also give you a DATA VALIDATION message if the Domain is not found. So you will be able to identify any new or not listed domain names in your data.
 
Last edited:
Upvote 0
After looking closer, that may be overthinking it..

Try

=VLOOKUP(REPLACE(A2,1,FIND("@",A2),""),'OtherSheet'!$A$2:$B$6,2,0)
 
Upvote 0
Awesome, thank you, that worked like a charm!!

In a separate formula, I'd also like to look for an email fragment, that has the same kind of wildcard. To see if "DomainFragment" (colA), appears in the "Email" (colA), and if so, return the corresponding value "Type" from Col B, like this:

emailfrag.jpg



emailfraghome.jpg



I'm trying to re-purpose formula you gave me above, but I must be doing something wrong. Help!
 
Upvote 0
Ahhh, that works really well, thank you! For some reason, though it seems to be tripping up on schools. and publicschools, from the first table in post #5. For those records, it's returning "#N/A" Is there a character limit on it, perhaps?
 
Upvote 0
Works fine for me.

Can you try using an HTML tool like ExcelJeanie (see my signature for a link)
To post a nicely formatted table to your post.
Pictures don't really help much, because we can't copy paste data from them to our own sheet for testing.
And most people won't take the time to retype your tables by hand.
 
Upvote 0
Good to know; I'll do that next time.

On my question and your reply in Post #8, I realized that I wasn't including all my rows correctly in the formula - once I fixed that, it works fine. Thank you so much!! :) :)
 
Upvote 0

Forum statistics

Threads
1,215,368
Messages
6,124,520
Members
449,169
Latest member
mm424

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