+ Reply to Thread
Results 1 to 5 of 5

Need formula to return value from table based on varying order of column headers

  1. #1
    Registered User
    Join Date
    03-12-2014
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    3

    Need formula to return value from table based on varying order of column headers

    I am setting up an invoice status spreadsheet where the data for the lookup table is copied in by the user. Depending on their source, the order of the columns may vary. The goal is for the user to get the status (e.g., Paid, Pending, Denied) based on invoice number ("Inv#"). This would be a simple lookup if I knew, for example, that invoice number would always be in column A of the data. However, that's not the case here.

    So for example, they may copy data in one time as:

    Date ID Name Inv# Amount Status

    and the next time the order could be:

    ID Inv# Status Date Amount

    As a result, I don't always know which column the Invoice number or Status is in order to do a simple lookup (Note that the number of columns may vary as well, but Inv# and Status will always be one of the columns). I tried an index-match formula, but that wouldn't work for me since, again, I didn't always know which column the Invoice # would be in. I know there's a way -- just not coming to me.

    Thanks in advance for your help.

  2. #2
    Forum Expert
    Join Date
    09-20-2011
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    2,278

    Re: Need formula to return value from table based on varying order of column headers

    Hello
    Try something like the following formula:

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Here the 'Data_Range' is the range including headers and the 'Inv_No' is as you would expect, the Invoice number you're looking up. Assuming each Invoice Number is unique and there's a 'Status' column header somewhere in the 'Column_Headers' range, then it should return the 'Status' of the Invoice Number.

    Hope this helps.
    DBY

  3. #3
    Registered User
    Join Date
    03-12-2014
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    3

    Thumbs up Re: Need formula to return value from table based on varying order of column headers

    Great. Worked as described. The only thing that I noticed is that it looks like the data range has to be a named range in the Sumproduct formula.

    Thanks for your help with this!

  4. #4
    Forum Expert
    Join Date
    09-20-2011
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    2,278

    Re: Need formula to return value from table based on varying order of column headers

    Hi
    Glad it worked. The SUMPRODUCT function doesn't need a named range to work. I just did that so you could understand the formula better.

  5. #5
    Registered User
    Join Date
    03-12-2014
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: Need formula to return value from table based on varying order of column headers

    Yes. You are correct. I had mismatched data ranges in the formula so that's why I received an "N/A" answer. Thanks again for all your 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] Return list of column headers based on cell value
    By akshaysudhir in forum Excel General
    Replies: 4
    Last Post: 04-17-2015, 06:10 AM
  2. [SOLVED] Return Column Headers based on row rank with duplicate values in row
    By carlwin in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-31-2013, 12:24 AM
  3. Replies: 7
    Last Post: 01-25-2013, 05:17 PM
  4. Replies: 11
    Last Post: 02-08-2012, 01:25 PM
  5. return a value based on column and row headers
    By jimmy1981 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-01-2012, 11:02 AM

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