Using Lookup

js2756

New Member
Joined
Apr 14, 2011
Messages
5
I am trying to convert a grade to a numerical equivalent:

lookup(A1, {"A*","A","B"},{58,52,46}) but if cell A1 contains the A star (A*) grade, the lookup formula returns 52 instead of 58.

I think it is a problem of interpreting the asterisk as a wildcard. How can I get the formula to work as expected?

Thanks

John
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
Welcome to MrExcel board...

does this help
Excel Workbook
AB
1a*58
Sheet1
Excel 2003
Cell Formulas
RangeFormula
B1=IF(A1="A",52,IF(AND(A1=LEN(A1)>1,LEFT(A1,1)="A"),58,IF(A1="B",46,"")))
 
Upvote 0
I am trying to convert a grade to a numerical equivalent:

lookup(A1, {"A*","A","B"},{58,52,46}) but if cell A1 contains the A star (A*) grade, the lookup formula returns 52 instead of 58.

I think it is a problem of interpreting the asterisk as a wildcard. How can I get the formula to work as expected?

Thanks

John
Just swap places with the A:

=LOOKUP(A1,{"A","A*","B"},{52,58,46})
 
Upvote 0
Thanks guys, these all do the job but I was wondering why Biff's version works and mine doesn't?


js
 
Upvote 0
Biff's is sorted where your's was not. Lookup needs the data to be sorted in ascending order.
 
Upvote 0
Thanks guys, these all do the job but I was wondering why Biff's version works and mine doesn't?


js
The lookup_vector must be sorted in ascending order for the function to work properly.

To see how Excel evaluates the sort order, simply enter the values in some cells then sort them in ascending order.

A*, A, B

will get sorted to

A, A*, B
 
Upvote 0

Forum statistics

Threads
1,224,599
Messages
6,179,828
Members
452,946
Latest member
JoseDavid

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