+ Reply to Thread
Results 1 to 16 of 16

Index/Match over several columns

  1. #1
    Registered User
    Join Date
    01-09-2013
    Location
    United States
    MS-Off Ver
    Excel 2013
    Posts
    27

    Index/Match over several columns

    So on my data sheet "Sheet 1" I have the following....

    Teacher Room Periods Using Rooms
    Joe 300 1A 1B 1C 1D 2A
    Jane 352 5A 5C


    Now on a separate sheet it it to match the room if they use it that period and return the teachers name.

    So for instance it should come out like this on "Sheet 2"....

    Room 1A 1B 1C 1D 2A 5A 5C
    300 Joe Joe Joe Joe Joe
    352 Jane Jane


    This is what I have
    =iferror(if(A2="","",index(Sheet1!A:A,match(A2&B1,Sheet1!B:B&Sheet1!H:I,0))))

    I know it wont work because of the H:I piece... not sure really how to replace it (maybe a different formula) so it can search all the columns in the row with that room number to see if there is a match.


    *as an added bonus I have to duplicate the formula over several rows and columns on "Sheet 2" ... any way to set up the formula so it will just drag and I don't have to do it manually to each cell? (if that makes sense)

    Thanks for your time.

  2. #2
    Forum Contributor
    Join Date
    03-28-2018
    Location
    Houston, TX
    MS-Off Ver
    Microsoft Office Professional Plus 2016
    Posts
    127

    Re: Index/Match over several columns

    I don't believe this is possible using the index/match combination or any other lookup combination of which I'm aware. My advice is to go one of two routes:

    1) Program it in VBA. There are many people who can help with that in this forum if that's what you decide.

    2) If VBA is not your thing, I suggest creating a 3rd sheet which combines the room number and the period (for each listed period) from 'Sheet1'. This can be done formulaicly. Then you can use an index/match formula as a way to get the data into 'Sheet2'.

  3. #3
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,926

    Re: Index/Match over several columns

    Brant, I have found that, in this forum, I try to avoid saying something is not possible in excel, because 1 or 2 of the real geniuses here have proved me wrong lol.

    1. I believe this IS possible with formulas maybe with or without helpers.
    2. It is also possible to use multiple criteria and criteria ranges in INDEX/MATCH (but not necessarily in this case)

    Traggs, is all your data so nicely sequenced and in order?
    Can you upload a small (clean) sample workbook (not a pic) of what you are working with, and what your expected outcome would look like.
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  4. #4
    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
    28,148

    Re: Index/Match over several columns

    Attach a sample workbook (not image).so that we do not have to manually key in your data to do any testing.

    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.

  5. #5
    Registered User
    Join Date
    01-09-2013
    Location
    United States
    MS-Off Ver
    Excel 2013
    Posts
    27

    Re: Index/Match over several columns

    Quote Originally Posted by FDibbins View Post
    Brant, I have found that, in this forum, I try to avoid saying something is not possible in excel, because 1 or 2 of the real geniuses here have proved me wrong lol.

    1. I believe this IS possible with formulas maybe with or without helpers.
    2. It is also possible to use multiple criteria and criteria ranges in INDEX/MATCH (but not necessarily in this case)

    Traggs, is all your data so nicely sequenced and in order?
    Can you upload a small (clean) sample workbook (not a pic) of what you are working with, and what your expected outcome would look like.
    Here is the google sheet so it is easy to share and for you to make a copy.
    https://docs.google.com/spreadsheets...it?usp=sharing

    The first 4 sheets contain the data. I created "Scrap" as scrap paper to sort out periods. Then the tab "Rooms" is where I need the formulas.

    I know this is an Excel forum but I really don't have an option, I have to make this work in Sheets. Sorry if that is an issue, hope we can still make it work.

  6. #6
    Registered User
    Join Date
    06-13-2018
    Location
    india
    MS-Off Ver
    2010;2007
    Posts
    54

    Re: Index/Match over several columns

    Hello, Assuming your table starts from A1 in both the sheet as given by you here then on second sheet use below in B2
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    change the references to suit your need

    if this helps then click add rep button at the bottom left corner of this post
    Attached Files Attached Files
    Last edited by kuschem; 06-15-2018 at 02:12 PM. Reason: attached file

  7. #7
    Registered User
    Join Date
    01-09-2013
    Location
    United States
    MS-Off Ver
    Excel 2013
    Posts
    27

    Re: Index/Match over several columns

    You are a GENIUS!! It works like a charm... but when I spread to whole sheet it is missing a few pieces of data.

    Looks like if you say room 350 is 1ABCD and on the next row 350 again is also 2BD then it won't take all the "350" information, just the first occurance. So it blocks out 1A 1B 1C 1D like charm but it fails to mark 2B and 2D.
    Last edited by AliGW; 06-19-2018 at 03:22 PM. Reason: Unnecesary quotation removed.

  8. #8
    Registered User
    Join Date
    06-13-2018
    Location
    india
    MS-Off Ver
    2010;2007
    Posts
    54

    Re: Index/Match over several columns

    Please update a sheet of sample data and yes this formula captures first instance and with little modification it can be worked out for duplicates too.

    Provide a sheet of sample data including 10 to 15 rows with result expected
    Last edited by kuschem; 06-16-2018 at 12:48 AM.

  9. #9
    Registered User
    Join Date
    01-09-2013
    Location
    United States
    MS-Off Ver
    Excel 2013
    Posts
    27

    Re: Index/Match over several columns

    The first 4 sheets contain the data. I created "Scrap" as scrap paper to sort out periods. Then the tab "Rooms" is where I need the formulas.
    https://docs.google.com/spreadsheets...it?usp=sharing
    Last edited by AliGW; 06-19-2018 at 03:22 PM. Reason: Unnecesary quotation removed.

  10. #10
    Registered User
    Join Date
    06-13-2018
    Location
    india
    MS-Off Ver
    2010;2007
    Posts
    54

    Re: Index/Match over several columns

    let me work on it! traggs

  11. #11
    Registered User
    Join Date
    06-13-2018
    Location
    india
    MS-Off Ver
    2010;2007
    Posts
    54

    Re: Index/Match over several columns

    copy paste below in rooms sheet at 3 row and 3rd column i.e. in 3C
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    then hold ctrl and shift then hit enter to make it array formula ! drag down and drag to right !

    if this helps then click add rep button at the bottom left corner of this post

  12. #12
    Registered User
    Join Date
    01-09-2013
    Location
    United States
    MS-Off Ver
    Excel 2013
    Posts
    27

    Re: Index/Match over several columns

    That is PERFECT!!! I need to learn a little more about SUMPRODUCT... i assume that it uses 1 for true 0 for false?

    Just so I can learn...

    Basically this formula has 3 parts in the "IF"
    SUMPRODUCT-
    it is looking for a room match (SUMPRODUCT(($A3=Scrap!$B$2:$B$58)
    then it looks for a period match (Rooms!C$1=Scrap!$G$2:$K$58)
    Not sure what the row is used for (ROW($2:$58)))=0
    **Then if there is no match, "0", it returns a blank. If there is any sort of match then it goes to
    INDEX
    it returns the teacher name (Scrap!$A$1:$A$58)
    Where
    SUMPRODUCT
    Room matches ($A3=Scrap!$B$2:$B$58)
    Period Matches (Rooms!C$1=Scrap!$G$2:$K$58)
    and again not sure what row means (ROW($2:$58)

    Lastly, was there a reason you put "Rooms!" in the formula if that was the sheet you were working on? Does it do anything special or is it insignifcant?

    Again, thank you SOOOO MUCH!
    Last edited by AliGW; 06-19-2018 at 03:23 PM. Reason: Unnecesary quotation removed.

  13. #13
    Registered User
    Join Date
    06-13-2018
    Location
    india
    MS-Off Ver
    2010;2007
    Posts
    54

    Re: Index/Match over several columns

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

    red part checks for room no in rooms sheet and generates true and false, blue part generates period no from scrap to rooms sheet and generates true and false and their multiplication gives 0's and One's as True*True as 1 and True* False as 0 this gets multiplied by row no when row no holding data gets multiplied by 1 its stays same and rest becomes 0
    sumproduct does sum of overall value in which there is only one no and rest are 0's this further checks a condition as if sum is 0 then return empty (" ") else index the row from overall row present in the data

    hope this solves your query!

    Thanks for the reply

  14. #14
    Registered User
    Join Date
    01-09-2013
    Location
    United States
    MS-Off Ver
    Excel 2013
    Posts
    27

    Re: Index/Match over several columns

    I think I got it. The row part is still a little fuzzy but I'll get it.

    One more addition... is there anyway to for it to result in "ERROR" if i have double booked the room (same room at the same period)?
    I would think to encapsulate the entire thing in another =if formula.
    Last edited by AliGW; 06-19-2018 at 03:23 PM. Reason: Unnecesary quotation removed.

  15. #15
    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,430

    Re: Index/Match over several columns

    Traggs - please don't quote whole posts, especially when you are responding to the one immediately preceding your own - it's just clutter. It's OK to quote if you are responding to a post out of sequence, but limit quoted content to a few relevant lines that makes clear to whom and what you are responding. Thanks!

    For normal conversational replies, try using the QUICK REPLY box below.
    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.

  16. #16
    Registered User
    Join Date
    01-09-2013
    Location
    United States
    MS-Off Ver
    Excel 2013
    Posts
    27

    Re: Index/Match over several columns

    Ok @kuschem I have an additional challenge to this formula.

    =IF(SUMPRODUCT(($A2=Scrap!$B$2:$B$1000)*(Rooms!B$1=Scrap!$G$2:$L$1000)*(ROW($2:$1000)))=0,"",IF(SUMPRODUCT(($A2=Scrap!$B$2:$B$1000)*(Rooms!B$1=Scrap!$G$2:$L$1000))>1,SUMPRODUCT(($A2=Scrap!$B$2:$B$1000)*(Rooms!B$1=Scrap!$G$2:$L$1000)),INDEX(Scrap!$A$1:$A$1000,SUMPRODUCT(($A2=Scrap!$B$2:$B$1000)*(Rooms!B$1=Scrap!$G$2:$L$1000)*(ROW($2:$1000))))))

    This is what I ended up with which works GREAT!!! What happens is if there is 1 match then it returns a name but >1 match returns a number. Is there a way to add on to this formula in order to make it so that when there is >1 match it will conatenate the names together (maybe with "/" between the names).

+ 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. Replies: 4
    Last Post: 04-14-2017, 07:47 PM
  2. 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
  3. [SOLVED] Cross Check Columns for Index Match Match
    By Harr in forum Excel Formulas & Functions
    Replies: 25
    Last Post: 12-31-2015, 11:35 AM
  4. [SOLVED] Using Index & Match (or similar) to check two columns for a match
    By dvs in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 10-30-2015, 07:07 PM
  5. Index/Match but the second match criteria >0 regarding 3 columns
    By Ben2487 in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 09-29-2014, 12:08 PM
  6. [SOLVED] Match Issue - Consolidate Columns of Data With Match/Index/etc?
    By excelsior123 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 07-03-2014, 05:14 PM
  7. Increment columns in INDEX and MATCH formula - ROWS and COLUMNS
    By nickmangan in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2012, 10:38 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