Strange Vlookup Behavior with COLUMNS Function

sayme

New Member
Joined
Apr 21, 2018
Messages
17
Hi guys,

Got a question about vlookup with columns functions. I use, VLOOKUP($B16,$B$4:$D$13,COLUMNS($B:B)+1,0) and I paste the formula across cells C16 and D16 to return matches of author and price. But when I use B$16 instead of $B16 in the formula, it returns a match in author but not price. If it returns a match in author why cant it return a match in price??



ABCD
3NumberBook TitleAuthorPrice
41A Game of ThronesGeorge R.R.$19.77
52Go to SleepAdam Mansbach$8.22
63A Dance with DragonsGeorge R.R.$18.81
74The Hunger GamesSuzanne Collins$4.94
85The Original ArgumentGlenn Beck$7.99
96Heaven is for RealTodd Burpo$9.34
107UnbrokenLaura Hillenbrand$13.99
118Smokin' SeventeenJanet Evanovich$15.21
129In the Garden of BeastsErik Larson$13.78
1310Catching FireSuzanne Collins$8.97

<colgroup><col style="width: 25pxpx"><col><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>
Sheet2
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
But when I use B$16 instead of $B16 in the formula, it returns a match in author but not price. If it returns a match in author why cant it return a match in price??
Because when you make that change and then copy the formula from column C to column D it becomes

=VLOOKUP(C$16,$B$4:$D$13,COLUMNS($B:C)+1,0)

This formula is trying to look up what is in column C (the author - returned from the formula in C16) in column B, which contains book titles, not authors.
 
Upvote 0
That is because the $ sign is an absolute reference. Meaning no matter where you put your formula it will always reference to a pecific column or a row. So, $B absolute column and $16 absolute row. So when you use B$16 and drag formula/or copy formula the result for author is correct, but for an amount reference changed to C$16. You want to keep $B16 to keep absolute reference on your column B since it will not change in this case and keep row (16) as is.
 
Upvote 0
Hi,

If you Want to use your VLOOKUP in the manner you described:

Instead of =VLOOKUP($B16,$B$4:$D$13,COLUMNS($B:B)+1,0)

Changed to =VLOOKUP(B$16,$B$4:$D$13,COLUMNS($B:B)+1,0)

Then you would Also need to change $B$4:$D$13 to B$4:$D$13 and COLUMNS($B:B) to COLUMNS($B:$B)

So now the formula will look like =VLOOKUP(B$16,B$4:$D$13,COLUMNS($B:$B)+1,0)

But since COLUMNS($B:$B) is basically a constant of 1, you would No longer need that function,

So the formula can just be =VLOOKUP(B$16,B$4:$D$13,2,0)

Now you can drag Either modified version of your VLOOKUP formula from Column C to Column D and get correct results for Arthur and Price.

See below for comparison, All C Column formulas copied to D:


Book1
ABCD
3NumberBook TitleAuthorPrice
41A Game of ThronesGeorge R.R.$19.77
52Go to SleepAdam Mansbach$8.22
63A Dance with DragonsGeorge R.R.$18.81
74The Hunger GamesSuzanne Collins$4.94
85The Original ArgumentGlenn Beck$7.99
96Heaven is for RealTodd Burpo$9.34
107UnbrokenLaura Hillenbrand$13.99
118Smokin' SeventeenJanet Evanovich$15.21
129In the Garden of BeastsErik Larson$13.78
1310Catching FireSuzanne Collins$8.97
14
15
16Go to SleepAdam Mansbach8.22
17Adam Mansbach8.22
18Adam Mansbach8.22
Sheet142
Cell Formulas
RangeFormula
C16=VLOOKUP($B16,$B$4:$D$13,COLUMNS($B:B)+1,0)
C17=VLOOKUP(B$16,B$4:$D$13,COLUMNS($B:$B)+1,0)
C18=VLOOKUP(B$16,B$4:$D$13,2,0)
 
Last edited:
Upvote 0
Now you can drag Either modified version of your VLOOKUP formula from Column C to Column D and get correct results for Arthur and Price.
I disagree. I have used your two modified formulas in rows 17 & 18 as suggested below, but they do not return the correct results when dragged to column D for price.

(Perhaps I'm not understanding, but I'm not sure why the OP is wanting to change a formula that seems to be doing the job perfectly as it is. :unsure:)

Excel Workbook
BCD
3Book TitleAuthorPrice
4A Game of ThronesGeorge R.R.$19.77
5Go to SleepAdam Mansbach$8.22
6A Dance with DragonsGeorge R.R.$18.81
7The Hunger GamesSuzanne Collins$4.94
8The Original ArgumentGlenn Beck$7.99
9Heaven is for RealTodd Burpo$9.34
10UnbrokenLaura Hillenbrand$13.99
11Smokin' SeventeenJanet Evanovich$15.21
12In the Garden of BeastsErik Larson$13.78
13Catching FireSuzanne Collins$8.97
14
15
16Catching FireSuzanne Collins8.97
17Suzanne Collins4.94
18Suzanne Collins4.94
Formula
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,908
Messages
6,122,187
Members
449,071
Latest member
cdnMech

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