+ Reply to Thread
Results 1 to 9 of 9

Using match to search for 1 criteria in multiple columns

  1. #1
    Registered User
    Join Date
    04-06-2019
    Location
    Canada
    MS-Off Ver
    2016
    Posts
    5

    Using match to search for 1 criteria in multiple columns

    101----102----103
    201----202----203
    301----302----303
    401----402----403

    I want the row number of value "202" within those 3 columns. Then i want the column number for that same value. If i do match(202,A1:C4,0) to get the row, it does not work.

  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,859

    Re: Using match to search for 1 criteria in multiple columns

    The MATCH function only works with a single column (or row) at a time.

    Is that really representative of your actual data? If so, you can find the row number using this:

    =INT(202/100)

    assuming the data starts in row 1, and the column number can be found with this:

    =MOD(202,100)

    assuming it starts in column A. In both cases the 202 could be replaced by a cell reference which holds the value of 202.

    I suspect, though, that your real data is somewhat different, so please clarify.

    Hope this helps.

    Pete

  3. #3
    Registered User
    Join Date
    04-06-2019
    Location
    Canada
    MS-Off Ver
    2016
    Posts
    5

    Re: Using match to search for 1 criteria in multiple columns

    my data looks like this:

    Math-------102----103----104
    English----404----405----EMPTY
    Gym--------203----204----205
    History----301----302----EMPTY

    Im working on a schedule maker. What i need to do is find the course name corresponding to a number in the same row. For example if i am searching for 405 i want the function to return "English". The number are days+period starting from Monday. So for example 405 would be Thursday 5th period.
    When i write down my schedule from that array it looks like this:

    Monday---Tuesday---Wednesday---Thursday---Friday
    1 X--------X---------?-----------X----------X
    2 Math-----X---------?-----------X----------X
    3 Math-----Gym-------X-----------X----------X
    4 Math-----Gym-------X-----------English----X
    5 X--------Gym-------X-----------English----X

    If i want to know what course i have on Wednesday 1st and 2nd period (where the ? are)i would look for the course name corresponding to the row # where 301 and 302 are in the 1st array.

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

    Re: Using match to search for 1 criteria in multiple columns

    Okay, but it would help if you attached a sample Excel workbook, so anyone trying to help you does not have to type out your data again before trying out possible solutions.

    To do this, click on Go Advanced (below the Edit Window) while you are composing a reply, then scroll down to and click on Manage Attachments and the Upload window will open. Click on Browse and navigate to (and double-click) the file icon that you want to attach, then click on Upload and then on Close this Window to return to the Edit window. When you have finished composing your post, click on Submit Post. Don't try to use the Paperclip icon, as this does not work on this forum.

    Hope this helps.

    Pete

  5. #5
    Registered User
    Join Date
    04-06-2019
    Location
    Canada
    MS-Off Ver
    2016
    Posts
    5

    Re: Using match to search for 1 criteria in multiple columns

    Like this? In the upper array the ?? are Friday, 4th and 5th periods. To find the course thats supposed to be there i look in the second array the course name that is at 504-505
    Attached Files Attached Files
    Last edited by Thormind; 04-06-2019 at 04:15 PM.

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

    Re: Using match to search for 1 criteria in multiple columns

    How do you know that Friday periods 4 and 5 contain either 504 or 505? Do you have another grid with the codes in which is then used to generate the grid with the subject names in?

    Pete

  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,859

    Re: Using match to search for 1 criteria in multiple columns

    Ah! I think I know what you mean now. Put this formula in cell B4:

    =IF(COUNTIF($B$10:$D$13,COLUMNS($B:B)*100+$A4)=0,"",INDEX($A$10:$A$13,IFERROR(MATCH(COLUMNS($B:B)*100+$A4,$B$10:$B$13,0),0)+IFERROR(MATCH(COLUMNS($B:B)*100+$A4,$C$10:$C$13,0),0)+IFERROR(MATCH(COLUMNS($B:B)*100+$A4,$D$10:$D$13,0),0)))

    Then you can copy this across and down your upper table (though it gives slightly different results than the names that you show).

    Hope this helps.

    Pete

  8. #8
    Registered User
    Join Date
    04-06-2019
    Location
    Canada
    MS-Off Ver
    2016
    Posts
    5

    Re: Using match to search for 1 criteria in multiple columns

    Quote Originally Posted by Pete_UK View Post
    Ah! I think I know what you mean now. Put this formula in cell B4:

    =IF(COUNTIF($B$10:$D$13,COLUMNS($B:B)*100+$A4)=0,"",INDEX($A$10:$A$13,IFERROR(MATCH(COLUMNS($B:B)*100+$A4,$B$10:$B$13,0),0)+IFERROR(MATCH(COLUMNS($B:B)*100+$A4,$C$10:$C$13,0),0)+IFERROR(MATCH(COLUMNS($B:B)*100+$A4,$D$10:$D$13,0),0)))

    Then you can copy this across and down your upper table (though it gives slightly different results than the names that you show).

    Hope this helps.

    Pete
    Thank you, i had been searching for hours! :-)

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

    Re: Using match to search for 1 criteria in multiple columns

    Glad it worked for you.

    If that takes care of your original question, please take a moment to select Thread Tools from the menu above and to the right of your first post in this thread, and mark the thread as SOLVED.

    Also, since you are relatively new to the forum, you might like to know that you can directly thank those who have helped you by clicking on the small "star" icon located in the lower left corner of any post that you have found to be helpful (not just in this thread - for any post that has helped you). This also adds to the reputation of the poster (the small green bars in the poster's profile).

    Pete

+ 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. Search Match with Multiple Criteria and Duplicates
    By Swaski in forum Excel General
    Replies: 6
    Last Post: 01-30-2017, 11:26 AM
  2. Replies: 17
    Last Post: 10-21-2016, 02:10 PM
  3. Replies: 3
    Last Post: 12-01-2015, 04:41 PM
  4. formulas for search based on multiple criteria in multiple columns
    By oneworld in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-02-2013, 06:57 AM
  5. Search data to see if any rows match multiple criteria
    By lafountain2209 in forum Excel General
    Replies: 1
    Last Post: 03-21-2013, 01:52 PM
  6. Search for Multiple Criteria and Return all Rows that Match.
    By Kimston in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-29-2013, 11:46 AM
  7. Search multiple columns for a match
    By [email protected] in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 07-25-2008, 10:23 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