Custpom Lookup formula not working.

countryfan_nt

Well-known Member
Joined
May 19, 2004
Messages
758
Hello friends, Hope all is well!

Please help me fix the formula below:

when I place Nov in A13; and end up getting 8!
when I enter Aug, I get: #N/A

=LOOKUP( I13, {"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"}, {"1","2","3","4","5","6","7","8","9","10","11","12"})

Please help, thank you very much in advance!
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
LOOKUP requires the lookup array to be in ascending order.
You might try a different approach:
=MONTH(DATEVALUE(A13&1))
 
Upvote 0
The formula I suggested is a more compact way to return the number of the month.
=MONTH(DATEVALUE(A13&1))

If you really want to use a lookup function, then consider something like this:
=VLOOKUP( A13, {"Jan",1;"Feb",2;"Mar",3;"Apr",4;"May",5;"Jun",6;"Jul",7;"Aug",8;"Sep",9;"Oct",10;"Nov",11;"Dec",12},2,FALSE)
VLOOKUP used with the FALSE option (4th argument) does an exact match and it does not require the lookup values to be in ascending order.

And if you really want to use the LOOKUP function, which requires a sorted (ascending) lookup array, then the arrays need to be manually sorted:
=LOOKUP( A13, {"Apr","Aug","Dec","Feb","Jan","Jul","Jun","Mar","May","Nov","Oct","Sep"}, {4,8,12,2,1,7,6,3,5,11,10,9})
 
Upvote 0

Forum statistics

Threads
1,214,920
Messages
6,122,276
Members
449,075
Latest member
staticfluids

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