ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Vlookup to the left (https://www.excelbanter.com/excel-worksheet-functions/95809-vlookup-left.html)

comparini3000

Vlookup to the left
 
I have the following in columns a and b:

_A__B_
Jan| 1 |
Feb| 2 |
Mar| 3 |
etc...

when a number is put into cell A15, i want A16 to return the month. this is
the formula i have:

=VLOOKUP(A15,A1:B12,1,FALSE)

unfortunately, it's returns #N/A. I know how to work the vlookup when, for
example, i'm looking up the month and i want the month number to be returned.
I can't get vlookup to work when the lookup value is in column 2 of the
array and the result value is in column 1. What am I doing wrong? Cheers

comparini3000

bpeltzer

Vlookup to the left
 
vlookup MUST have the key values in the left-most column. To do a lookup
with the table structured otherwise, you'd first do a MATCH to determine how
far down in the table to look, then an INDEX to go that far down in your
chosen column:
=index(a:a,match(a15,b:b,0)-1)

"comparini3000" wrote:

I have the following in columns a and b:

_A__B_
Jan| 1 |
Feb| 2 |
Mar| 3 |
etc...

when a number is put into cell A15, i want A16 to return the month. this is
the formula i have:

=VLOOKUP(A15,A1:B12,1,FALSE)

unfortunately, it's returns #N/A. I know how to work the vlookup when, for
example, i'm looking up the month and i want the month number to be returned.
I can't get vlookup to work when the lookup value is in column 2 of the
array and the result value is in column 1. What am I doing wrong? Cheers

comparini3000


Kevin Vaughn

Vlookup to the left
 
You can't use vlookup when you want to return something to the left of the
lookup range. Try index/match instead:

=INDEX($A$2:$A$13,MATCH(A15,$B$2:$B$13,0))

--
Kevin Vaughn


"comparini3000" wrote:

I have the following in columns a and b:

_A__B_
Jan| 1 |
Feb| 2 |
Mar| 3 |
etc...

when a number is put into cell A15, i want A16 to return the month. this is
the formula i have:

=VLOOKUP(A15,A1:B12,1,FALSE)

unfortunately, it's returns #N/A. I know how to work the vlookup when, for
example, i'm looking up the month and i want the month number to be returned.
I can't get vlookup to work when the lookup value is in column 2 of the
array and the result value is in column 1. What am I doing wrong? Cheers

comparini3000


comparini3000

Vlookup to the left
 
ahh...ok. thank you both very much

Kevin Vaughn

Vlookup to the left
 
You are welcome.
--
Kevin Vaughn


"comparini3000" wrote:

ahh...ok. thank you both very much



All times are GMT +1. The time now is 08:52 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com