+ Reply to Thread
Results 1 to 5 of 5

Lookup Formula Based on Header Title Not Column Number

  1. #1
    Registered User
    Join Date
    04-20-2023
    Location
    England
    MS-Off Ver
    Microsoft 365 Enterprise
    Posts
    24

    Lookup Formula Based on Header Title Not Column Number

    Hello,

    I am struggling with finding a formula that works.

    I have 2 sheets of data. I need to lookup something on the 2nd sheet based on value of cell "A2" from the 1st sheet which is Material Number. The thing is - the data on the 2nd sheet always changes and the column numbers aren't always in the same order, so I cannot use a simple "vLookup" formula. I need a vlookup-style formula that is based on the title in the headers, because the titles always stay the same, instead of being based on the column number.

    Is this possible?

    See attached workbook, where I tried to incorporate the "match" function into my vlookup, but to no avail.

    Thanks
    Attached Files Attached Files

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,898

    Re: Lookup Formula Based on Header Title Not Column Number

    Try this:

    =INDEX(Sheet2!$C$2:$T$17,MATCH(A2,Sheet2!$A$2:$A$17,0),MATCH("AGB1-",Sheet2!$C$1:$T$1,0))
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    24,731

    Re: Lookup Formula Based on Header Title Not Column Number

    Change your formula in C2 of Sheet1 to this:

    =VLOOKUP(A2,Sheet2!A:T,MATCH("AGB1-",Sheet2!A$1:T$1,0),0)

    Hope this helps.

    Pete

  4. #4
    Registered User
    Join Date
    04-20-2023
    Location
    England
    MS-Off Ver
    Microsoft 365 Enterprise
    Posts
    24

    Re: Lookup Formula Based on Header Title Not Column Number

    Thank you both!!

  5. #5
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,898

    Re: Lookup Formula Based on Header Title Not Column Number

    Glad to have helped.

    If that takes care of your original question, please choose Thread Tools from the menu link above and mark this thread as SOLVED.

    Also, if you have not already done so, you may not be aware that you can thank anyone who offered you help towards a solution for your issue by clicking the small star icon (* Add Reputation) located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of all those who offered help.

+ 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. [SOLVED] Macro to clear column based on header title
    By phbryan in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-06-2022, 02:21 PM
  2. [SOLVED] lookup column header based on cell value found from row name
    By mtwa1990 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-06-2020, 02:47 PM
  3. [SOLVED] Reverse lookup. Search header/title from the data
    By babychai in forum Excel General
    Replies: 3
    Last Post: 06-10-2020, 11:55 AM
  4. VBA to Lookup all Rows based on Column Header
    By matt85webb in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-14-2018, 07:23 PM
  5. Replies: 4
    Last Post: 10-19-2012, 12:09 PM
  6. Lookup Column Header based on cell value
    By kingcal in forum Excel General
    Replies: 4
    Last Post: 08-13-2009, 03:56 AM
  7. Replies: 1
    Last Post: 01-30-2009, 07:40 PM

Tags for this Thread

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