+ Reply to Thread
Results 1 to 6 of 6

Using INDEX/MATCH with variable column names

  1. #1
    Registered User
    Join Date
    05-03-2017
    Location
    Orlando, FL
    MS-Off Ver
    2013
    Posts
    3

    Using INDEX/MATCH with variable column names

    I have a spreadsheet that I use to track our monthly incoming and outgoing products. Right now, I'm using an INDEX/MATCH formula to pull data from other worksheets, which works fairly well. The only problem is that each month, as I rotate months on my report, I have to go through and update my formulas to pull from the appropriate columns which can be a bit time consuming.

    Here's the current formula that I'm using:
    =INDEX('Incoming orders'!R:R,MATCH(C4,'Incoming orders'!A:A,0))

    In this formula, the 'Incoming orders'!R:R refers to the column labeled "MAY" on the 'Incoming orders' worksheet. But next month, I will be shifting all of the months again, so then that first column will be for JUNE instead of MAY.

    Is there any way I can use the INDEX/MATCH function to pull from the column that corresponds to the value at L2 (the 1st month)?

    EDIT: Attached is a sample worksheet for reference.
    Attached Files Attached Files
    Last edited by Brimtown; 05-03-2017 at 12:45 PM.

  2. #2
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    30,929

    Re: Using INDEX/MATCH with variable column names

    Attach a sample workbook (not image).

    Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.

  3. #3
    Registered User
    Join Date
    05-03-2017
    Location
    Orlando, FL
    MS-Off Ver
    2013
    Posts
    3

    Re: Using INDEX/MATCH with variable column names

    Thanks for the advise, first time using this forum. I've attached a demo spreadsheet to show what I'm working with. The "AFTER" tab is what it will look like next month, after I rotate the months (my main report goes 6 months out)

  4. #4
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP, 2007, 2024
    Posts
    16,460

    Re: Using INDEX/MATCH with variable column names

    The INDEX() function can take up to three arguments (yours only has two). The first argument is the range to extract from, the second argument is the desired row # from that range, and the third argument is the desired column #. When I want to do something like what you are describing, I use a 2D range reference for the first argument, and specify (by whatever algorithm makes sense to the given problem) both the row number and column number. In your case, it might make sense to use two MATCH() functions, one for the row # and one for the column #. Maybe something like: =INDEX('Incoming orders'!$E$1:$AE$44,MATCH(C4,'Incoming orders'!A:A,0),match(J$2,'Incoming orders'!$E$1:$AE$1,0)) or whatever algorithm works for specifying that you want to pull from row # and col # of the incoming orders spreadsheet.
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  5. #5
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    30,929

    Re: Using INDEX/MATCH with variable column names

    In "AFTER"

    in J4

    =INDEX('Incoming orders'!$F:$AJ,MATCH($A4,'Incoming orders'!$A:$A,0),MATCH(AFTER!J$2,'Incoming orders'!$F$1:$AJ$1,0))

    Copy across

    Ensure month names are consistent ("JUNE" vs "JUN")
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    05-03-2017
    Location
    Orlando, FL
    MS-Off Ver
    2013
    Posts
    3

    Re: Using INDEX/MATCH with variable column names

    Thank you very much, that seems to have done exactly what I wanted!

+ 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. Three Variable Match / Index (With different column headings)
    By burgie10 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 04-04-2015, 12:54 PM
  2. [SOLVED] Converting Hlookup to Index Match with variable column index number
    By SimonLock in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 01-09-2015, 09:14 AM
  3. Variable Column Height Index/Match
    By absentminded in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 12-23-2014, 06:20 PM
  4. [SOLVED] Combining 3 Formulas: Return all Names that Match Criteria Using Index/Match
    By bchilme in forum Excel Formulas & Functions
    Replies: 20
    Last Post: 09-29-2014, 09:28 AM
  5. Index Match Match Formula DOESN'T WORK WITH TABLES/TABLE NAMES ??
    By Underling in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 02-04-2014, 09:01 PM
  6. Replies: 6
    Last Post: 11-08-2013, 10:29 PM
  7. How to Index and match to return the last value from variable column
    By abshmo5 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 08-27-2013, 04:59 AM

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