+ Reply to Thread
Results 1 to 8 of 8

Index and match on multiple columns

  1. #1
    Forum Contributor
    Join Date
    07-04-2013
    Location
    United States
    MS-Off Ver
    Excel for Mac -V 16.33 -- Office 365
    Posts
    279

    Index and match on multiple columns

    I am trying to use the index/match formula to for a new date and time scheduler we are creating where the user selects their name from the drop down menu and the results in the corresponding list shows their desired date and time. The challenge is there are 2 columns to lookup. I can get the date, but I cant' get the time because it resides in a row instead of a column.

    Attached is my worksheet. Any assistance would be appreciated.

    Thanks in advance.
    Attached Files Attached Files

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

    Re: Index and match on multiple columns

    You could use this formula in H5:

    =IF(COUNTIF($C$5:$C$12,F5),$C$4,IF(COUNTIF($D$5:$D$12,F5),$D$4,""))

    then copy down.

    Hope this helps.

    Pete

  3. #3
    Forum Expert
    Join Date
    07-06-2004
    Location
    Northern California
    MS-Off Ver
    2K, 2003, 2010, O365
    Posts
    1,490

    Re: Index and match on multiple columns

    Try these formulas instead.

    G5: =INDEX($B:$B,1/(1/MAX(COUNTIF($F5,$C$5:$D$12)*ROW($C$5:$D$12))))

    H5: =INDEX($4:$4,1/(1/MAX(COUNTIF($F5,$C$5:$D$12)*COLUMN($C$5:$D$12))))

    Select G5:H5 and fill down into G6:H27. The thing to note is that there's no overlap between dates and times in C5:D12, so the COUNTIF calls above return arrays with one or zero 1s. When there's one 1, multiplying the COUNTIF result by either the ROW or COLUMN result gives the row or column number of the only match in C5:D12. The MAX call picks that up. The 1/(1/x) idiom returns x when x is nonzero, otherwise returns a #DIV/0! error when the COUNTIF call returns zero 1s (all 0s).

    You could wrap these formulas inside IFERROR calls, but that'd catch all possible errors. That more often than not a bad idea. You could use conditional formatting to hide specific error values like #DIV/0!. Select G5:H27 with G5 the active cell, set the FORMULA condition as =COUNT(1/(ERROR.TYPE(G5)=2)) and the number format to ;;; .
    Last edited by hrlngrv; 01-11-2020 at 05:16 PM. Reason: typos

  4. #4
    Forum Expert
    Join Date
    07-06-2004
    Location
    Northern California
    MS-Off Ver
    2K, 2003, 2010, O365
    Posts
    1,490

    Re: Index and match on multiple columns

    ignore duplicate posted in error

  5. #5
    Forum Contributor
    Join Date
    07-04-2013
    Location
    United States
    MS-Off Ver
    Excel for Mac -V 16.33 -- Office 365
    Posts
    279

    Re: Index and match on multiple columns

    Thank you Pete. This was exactly what I was looking for. I noticed your formula was not an array. Is there a way to modify the formula I used for cell G5 to avoid the array? Just curious.

  6. #6
    Forum Contributor
    Join Date
    07-04-2013
    Location
    United States
    MS-Off Ver
    Excel for Mac -V 16.33 -- Office 365
    Posts
    279

    Re: Index and match on multiple columns

    Thank you.

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

    Re: Index and match on multiple columns

    You could use this formula in G5:

    =IFERROR(INDEX(B:B,MATCH(F5,C:C,0)),IFERROR(INDEX(B:B,MATCH(F5,D:D,0)),""))

    then copy down as required.

    Hope this helps.

    Pete

  8. #8
    Forum Contributor
    Join Date
    07-04-2013
    Location
    United States
    MS-Off Ver
    Excel for Mac -V 16.33 -- Office 365
    Posts
    279

    Re: Index and match on multiple columns

    Nailed it. Thank you!!

+ 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] index match from multiple columns
    By wayneg in forum Excel General
    Replies: 3
    Last Post: 01-08-2019, 05:39 AM
  2. Index Match across multiple columns
    By cfitz97 in forum Excel General
    Replies: 2
    Last Post: 06-15-2018, 08:53 PM
  3. [SOLVED] Index match to sum multiple match columns
    By rosboy in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 04-18-2018, 04:14 PM
  4. Match Index multiple columns
    By jewbsur0 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 10-19-2016, 10:15 AM
  5. INDEX MATCH MATCH multiple columns with same heading
    By djm198 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 07-11-2016, 02:34 PM
  6. Index Match Across Multiple Columns
    By FFastZB in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 03-20-2013, 04:58 PM
  7. [SOLVED] Index/Match across multiple columns
    By BB1972 in forum Excel General
    Replies: 2
    Last Post: 07-27-2012, 12:05 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