+ Reply to Thread
Results 1 to 3 of 3

How to refer to a column by value in first row instead of letter

  1. #1
    Registered User
    Join Date
    02-18-2022
    Location
    US
    MS-Off Ver
    Mac
    Posts
    4

    How to refer to a column by value in first row instead of letter

    Hiya! Sometimes I set up a formula to get values from another sheet. For example:

    Please Login or Register  to view this content.
    But then, one day when pasting data into that sheet, I find that the columns have moved from their previous position. I think it would be better if, as a matter of best practice, instead of referring to a cell like "C2" I could locate the cell using the value of the first row which act as headers (it's not a table though). For example, the formula would refer to row two of whatever column has "Name" in the first row of that column.

    I googled around and think this might be a problem for INDEX and MATCH. Does that sound right?

  2. #2
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    11,843

    Re: How to refer to a column by value in first row instead of letter

    If you had a block of cells where the top left cell is A1 and the bottom right is, e.g. Z50, and "Name is somewhere in row one then:
    Index('Data_Source'!A1:Z50,0,Match("Name",'Data_Source'!A1:Z1,0)
    will access all rows of the column where Name is found. You would need another MATCH() to replace 0, to get a specific row
    Ben Van Johnson

  3. #3
    Registered User
    Join Date
    02-18-2022
    Location
    US
    MS-Off Ver
    Mac
    Posts
    4

    Re: How to refer to a column by value in first row instead of letter

    Brilliant! I was able to get it to work. Thanks for helping me level-up!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 2
    Last Post: 03-04-2021, 11:08 AM
  2. Replies: 6
    Last Post: 03-30-2016, 04:28 PM
  3. Conditional Format: Highlight cells in Column C that refer to Column B
    By agf12555 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 08-26-2015, 05:16 PM
  4. Refer to columns by number instead of letter
    By GerPis in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-23-2012, 11:29 AM
  5. Replies: 6
    Last Post: 10-13-2005, 05:05 AM
  6. [SOLVED] How to replace column letter in refferences with a function using the old column letter?
    By Dmitry Kopnichev in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 10-13-2005, 05:05 AM
  7. Replies: 2
    Last Post: 05-09-2005, 04:06 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1