LOOKUP not finding text

ptm555

New Member
Joined
Jun 17, 2008
Messages
24
Hi all, first time on and realise that this question has probably been asked countless times before but I haven't found any suitable answers yet...so apologies in advance if this is a repeated question.

I am trying to use LOOKUP to display certain numbers when a range of words are searched. As such, this is the formula I am using:

=LOOKUP(N2,{"Once Only","Per Day","Per Week","Per Month","Per Year"},{1,1,5,20,260})

E.g. If "Once Only" is found a '1' is displayed and so on and so forth..

Problem is, Excel can't seem to find "Per Month" within a range of cells that do contain it, so it never shows the number 20! :confused:

Any idea why this could be? I've tried checking for spaces in the 'Per Month' cells but no joy. I'm using Excel 2003 if that makes any difference.

Any help is much appreciated
thanks
Peter
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
Hi Peter & Welcome to the Board!

LOOKUP expects your results to be sorted ascending which yours aren't ("Per Week" should come after "Per Month" on an alphabetical basis) - hence the problem.
 
Upvote 0
Welcome to the board....

Problem is, Excel can't seem to find "Per Month" within a range of cells that do contain it

Does that mean the cell might be "5 times Per Month", not just "Per Month" ??

If so, put wildcards in there

=LOOKUP(N2,{"*Once Only*","*Per Day*","*Per Week*","*Per Month*","*Per Year*"},{1,1,5,20,260})

Hope this helps...


P.S. And what Richard Said....LOL...
 
Upvote 0
Hi all, first time on and realise that this question has probably been asked countless times before but I haven't found any suitable answers yet...so apologies in advance if this is a repeated question.

I am trying to use LOOKUP to display certain numbers when a range of words are searched. As such, this is the formula I am using:

=LOOKUP(N2,{"Once Only","Per Day","Per Week","Per Month","Per Year"},{1,1,5,20,260})

E.g. If "Once Only" is found a '1' is displayed and so on and so forth..

Problem is, Excel can't seem to find "Per Month" within a range of cells that do contain it, so it never shows the number 20! :confused:

Any idea why this could be? I've tried checking for spaces in the 'Per Month' cells but no joy. I'm using Excel 2003 if that makes any difference.

Any help is much appreciated
thanks
Peter

Hi Peter:

The values in lookup_vector must be placed in ascending order ... so one way would be to use ...
=LOOKUP(N2,{"Once Only","Per Day","Per Month","Per Week","Per Year"},{1,1,20,5,260})

or

you may use VLOOKUP function ...
=VLOOKUP(N2,{"Once Only",1;"Per Day",1;"Per Week",5;"Per Month",20;"Per Year",260},2,0)

I hope this helps.
 
Upvote 0

Forum statistics

Threads
1,214,899
Messages
6,122,155
Members
449,068
Latest member
shiz11713

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