Reference Entire Column Using Column Number

Barklie

Board Regular
Joined
Jul 4, 2013
Messages
86
Hello,

I have an inventory data set where new products (columns) are constantly being added. I want a formula that can

1) Find the column of the product I am looking for
2) Return the last value in that column

The match formula does a good job of returning the column number I am looking for:
=MATCH(A11,Records!1:1,0)

And I found a nifty formula for finding the last value in a column:
=LOOKUP(2,1/(Records!L:L<>""),Records!L:L)

The problem is that the second formula uses the "A:A" format when I need it to be able to use the column number instead.

Thanks,
Barklie
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
this is clunky but how about

=SUBSTITUTE(ADDRESS(1,COLUMN(),4),"1","") & ":" & SUBSTITUTE(ADDRESS(1,COLUMN(),4),"1","")

Would have to wrap in INDIRECT
 
Last edited:
Upvote 0
This will give you incremental letters as you copy it across (up to Z)...
=CHAR(65+COLUMNS($A$1:A1)-1)
 
Upvote 0
Thanks Roderick. Unfortunately, I can't get this to work because the INDIRECT function doesn't seem to work with other sheets. The formula below returns the last value in the correct column for the current sheet instead of the "Records" sheet.

=LOOKUP(2,1/(INDIRECT(SUBSTITUTE(ADDRESS(1,MATCH(A11,Records!1:1,0),4),"1","") & ":" & SUBSTITUTE(ADDRESS(1,MATCH(A11,Records!1:1,0),4),"1",""))<>""),INDIRECT(SUBSTITUTE(ADDRESS(1,MATCH(A11,Records!1:1,0),4),"1","") & ":" & SUBSTITUTE(ADDRESS(1,MATCH(A11,Records!1:1,0),4),"1","")))
 
Upvote 0
Thanks for the reply. However, most of the products are beyond column Z, so that formula is a little too limited.
 
Upvote 0
This will go beyound z and into AA, AB etc up to ZZ...
=IF(COLUMNS($A$1:A1)<27,"",CHAR(INT(65+(COLUMNS($A$1:A1)-1)/26)-1))&CHAR(65+MOD(COLUMNS($A$1:A1)-1,26))
 
Upvote 0

Forum statistics

Threads
1,222,090
Messages
6,163,846
Members
451,861
Latest member
Lurch65

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