If Contains x or y display value.

AndyGray

New Member
Joined
May 31, 2017
Messages
30
=IFERROR(IF(SEARCH("*07*",K20),K20,0),"")

This will extract 07 from my cell and display any contacts with this number... However I want it to say....


If Cell K20 contains 07 or 01 then place it in current cell. If not display nothing...

(I'm trying to filter emails and phone numbers out)...

And I might want to advance this in the future to filter landlines and mobiles...

So i would need an additional formula saying "If the left 2 characters contain 01 then display this full cell in current cell" (this is for landlines) then for mobiles I will do 08.

Thanks
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
If Cell K20 contains 07 or 01 then place it in current cell. If not display nothing...

Hi, you can try like this:

=IF(ISNUMBER(LOOKUP(1,-SEARCH({"07","01"},K20))),K20,"")

Or if you really wanted to know if it starts with 07 or 01, rather than just contains.

=IF(OR(LEFT(K20,2)={"07","01"}),K20,"")
 
Upvote 0
Hi, you can try like this:

=IF(ISNUMBER(LOOKUP(1,-SEARCH({"07","01"},K20))),K20,"")

Or if you really wanted to know if it starts with 07 or 01, rather than just contains.

=IF(OR(LEFT(K20,2)={"07","01"}),K20,"")

Some of the fields have had data added to them such as "Mob = 07" As i've ran that i've just discovered this problem. So is number won't work because they also contain text. So would need more so "IF it contains 01 or 07" .
 
Upvote 0
I'd tried it and it was bringing back no values. In the end i've collated the data into 1 cell for now into one field and will be addressing this in the future. Because our data contains text at the start of some numbers, some 07 will be +447 and some 01 numbers will have 07 somewhere else in the number there was a lot of legwork to do for the result it would achieve.

Thanks.
 
Upvote 0
I'd tried it and it was bringing back no values.

Hi, in situations like this it's always best if you can post some actual examples of your inputs so we have something to test with.

our data contains text at the start of some numbers, some 07 will be +447 and some 01 numbers will have 07 somewhere else in the number

in lieu of some sample data, here are some minor modifications to handle those variations.


Excel 2013/2016
KL
20mob = 071234567mob = 071234567
21tel = 011234567tel = 011234567
22071234567071234567
230123456701234567
24110711
25990199
26mob = 990199
27mob =971234567
28mob = +4471234567mob = +4471234567
29+4471234567+4471234567
30text 07123213text 07123213
Sheet1
Cell Formulas
RangeFormula
L20=IF(ISNUMBER(LOOKUP(1,-SEARCH({" 07"," 01"," +447"}," "&K20))),K20,"")
 
Upvote 0

Forum statistics

Threads
1,214,542
Messages
6,120,116
Members
448,945
Latest member
Vmanchoppy

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