Number Search in Formula return wrongs information.

helpme20

Board Regular
Joined
Aug 28, 2010
Messages
102
In the formula I am using below:


=IF(ISNUMBER(LOOKUP(9.99999999999999E+307,SEARCH(b1,INDIRECT("'2011a.xlsx'!"&codes)))),LOOKUP(9.99999999999999E+307,SEARCH(b1,INDIRECT("'2011a.xlsx'!"&codes)),INDIRECT("'2011a.xlsx'!"&prodname)),"")


In column B1, my number I am searching for is between a 4 and 6 digit number.

If I put in 5229, it will still return the information associated with Code 522922.

Is there something I can add to my formula to correct this?
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
=IFERROR(LOOKUP(1E100,SEARCH(B15&",",B2:B13&","),C2:C13),"")

Biff/helpme20
I think that still has the same sort of issue referred to here ..
If I put in 5229, it will still return the information associated with Code 522922.
.. see my changed data in B11 below and your formula result in cell B16. I think both the prefix & suffix to the number need to be checked/enforced per the formula amendment in B17.

Excel Workbook
BC
2564223Potassium Hydroxide 50%
3694885Potassium Hydroxide AR Pellets
4390311Potassium Lactate
5569375, 345976, 98765, 132060, 421414, 548190Potassium MetaBisulfite
65229Potassium Nitrate
7790556Potassium Nitrite
8856094Potassium Permanganate
9503659, 565346, 480890, 522922Potassium Persulfate
10640919Potassium Phosphate Monobasic (Kilo)
1167679, 849244, 65229, 742602Potassium Phosphate Tripolyphosphate
12948555Potassium Sorbate
13192122Potassium Stannate
14
155229
16Potassium Phosphate Tripolyphosphate
17Potassium Nitrate
Lookup
 
Upvote 0
Biff/helpme20
I think that still has the same sort of issue referred to here .... see my changed data in B11 below and your formula result in cell B16. I think both the prefix & suffix to the number need to be checked/enforced per the formula amendment in B17.

Excel Workbook
BC
2564223Potassium Hydroxide 50%
3694885Potassium Hydroxide AR Pellets
4390311Potassium Lactate
5569375, 345976, 98765, 132060, 421414, 548190Potassium MetaBisulfite
65229Potassium Nitrate
7790556Potassium Nitrite
8856094Potassium Permanganate
9503659, 565346, 480890, 522922Potassium Persulfate
10640919Potassium Phosphate Monobasic (Kilo)
1167679, 849244, 65229, 742602Potassium Phosphate Tripolyphosphate
12948555Potassium Sorbate
13192122Potassium Stannate
14
155229
16Potassium Phosphate Tripolyphosphate
17Potassium Nitrate
Lookup
Yeah, that'll make it more robust.
 
Upvote 0
Biff/helpme20
I think that still has the same sort of issue referred to here .... see my changed data in B11 below and your formula result in cell B16. I think both the prefix & suffix to the number need to be checked/enforced per the formula amendment in B17.

Excel Workbook
BC
2564223Potassium Hydroxide 50%
3694885Potassium Hydroxide AR Pellets
4390311Potassium Lactate
5569375, 345976, 98765, 132060, 421414, 548190Potassium MetaBisulfite
65229Potassium Nitrate
7790556Potassium Nitrite
8856094Potassium Permanganate
9503659, 565346, 480890, 522922Potassium Persulfate
10640919Potassium Phosphate Monobasic (Kilo)
1167679, 849244, 65229, 742602Potassium Phosphate Tripolyphosphate
12948555Potassium Sorbate
13192122Potassium Stannate
14
155229
16Potassium Phosphate Tripolyphosphate
17Potassium Nitrate
Lookup


This code above in B17 works perfectly. When someone using Excel 2003 opens the .xlsx version, it trys to convert it and has alot of errors.

What would be the code to write the above formula in 2003 code?
 
Upvote 0
This code above in B17 works perfectly. When someone using Excel 2003 opens the .xlsx version, it trys to convert it and has alot of errors.

What would be the code to write the above formula in 2003 code?
Try this one will work in any version of Excel:

=LOOKUP("zzzzz",CHOOSE({1,2},"",LOOKUP(1E100,SEARCH(B15&",",B2:B13&","),C2:C13)))
 
Upvote 0
In the formula I am using below:


=IF(ISNUMBER(LOOKUP(9.99999999999999E+307,SEARCH(b1,INDIRECT("'2011a.xlsx'!"&codes)))),LOOKUP(9.99999999999999E+307,SEARCH(b1,INDIRECT("'2011a.xlsx'!"&codes)),INDIRECT("'2011a.xlsx'!"&prodname)),"")


In column B1, my number I am searching for is between a 4 and 6 digit number.

If I put in 5229, it will still return the information associated with Code 522922.

Is there something I can add to my formula to correct this?

Define BigNum as referring to (using Insert | Name | Define or Formulas | Name Manager)...

=9.99999999999999E+307

Let B1 house a search string like 5229, E1 codes, and F1 prodname.

Note that codes and prodname must not be defined as dybamic named ranges.

If you are on Excel 2007 or later, try...

=IFERROR(LOOKUP(BigNum,SEARCH(" "&B1&","," "&INDIRECT("'2011.xlsx'!"&$E$1)&","),INDIRECT("'2011.xlsx'!"&$F$1)),"")

On all (other) systems...

First define BigStr as referring to...

=REPT("z",255)

and now invoke:

=LOOKUP(BigStr,CHOOSE({1,2},"",LOOKUP(BigNum,SEARCH(" "&B1&","," "&INDIRECT("'2011.xlsx'!"&$E$1)&","),INDIRECT("'2011.xlsx'!"&$F$1))))
 
Upvote 0

Forum statistics

Threads
1,224,521
Messages
6,179,283
Members
452,902
Latest member
Knuddeluff

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