Using an Array of numbers to search within a cells contents

cbarryb

New Member
Joined
Jun 1, 2012
Messages
34
Office Version
  1. 365
Platform
  1. Windows
  2. Web
Hi All,

One quick question about an array of numbers within a search function - Can this be done?

I have this bunch of nested iferror(mid(seach functions looking for all types of invoice numbers in the cells on our statements, making them easier to find. One problem I face is when a number changes, i.e. goes from 91200000 to 91300000, I have to add another iferror to the macro that inserts this formula.

is there a way to have this insert the formula, but using an array:

This is the main formula

=IFERROR(MID($B16,SEARCH("??????PW",$B16),8),IFERROR(MID($B16,SEARCH("??????IW",$B16),8),IFERROR(MID($B16,SEARCH("??????PV",$B16),8),IFERROR(MID($B16,SEARCH("911?????",$B16),8),IFERROR(MID($B16,SEARCH("2001????",$B16),8),IFERROR(MID($B16,SEARCH("908?????",$B16),8),IFERROR(MID($B16,SEARCH("910?????",$B16),8),IFERROR(MID($B16,SEARCH("912?????",$B16),8),IFERROR(MID($B16,SEARCH("909?????",$B16),8),"")))))))))

Could I use an array like this, or am I just in a dream world?

=IFERROR(MID($B24,SEARCH("91{1,2,3,4,5,6,7,8,9}?????",$B24),8)

Many thanks
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
Something like this should do it, you might need to array confirm the formula using Ctrl Shift Enter if you're working with excel 2019 or older.
Excel Formula:
=IFERROR(LOOKUP("zzz",MID($B24,SEARCH("91"&{1,2,3,4,5,6,7,8,9}&"?????",$B24),8)),"")
 
Upvote 0
Something like this should do it, you might need to array confirm the formula using Ctrl Shift Enter if you're working with excel 2019 or older.
Excel Formula:
=IFERROR(LOOKUP("zzz",MID($B24,SEARCH("91"&{1,2,3,4,5,6,7,8,9}&"?????",$B24),8)),"")
Thank you, that has worked for me, Top Person. I'll aslo update the version of Office I use, its 365 :)
 
Upvote 0

Forum statistics

Threads
1,215,761
Messages
6,126,735
Members
449,333
Latest member
Adiadidas

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