+ Reply to Thread
Page 1 of 2 12 LastLast
Results 1 to 15 of 17

Thread: Index Match Function

  1. #1
    Registered User
    Join Date
    06-19-2011
    Location
    PA
    MS-Off Ver
    Excel 2010(Win)/2011(Mac)
    Posts
    9

    Index Match Function

    Hi,

    I am trying to use to index match function to grab values from one worksheet on two criteria, State and Year. I have data from 18 years and the setup of the worksheet with the data in it has each state listed 18 times and then the year next to each.

    So when trying to use the index match function I get #N/A, is this because it is seeing multiple entries of each state and year? Is there anyway to fix this?

    Basically I want it to look at the data and grab it based on matching state AND year.

    I'm fairly confident that I am entering it correctly because I used it to grab data from another worksheet except the states were in column A and the year in row 1 so there was only one entry for each state/year.

    Any help would be appreciated, thanks.
    Last edited by yoss15; 06-21-2011 at 08:36 PM.

  2. #2
    Forum Guru jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    San Antonio, TX
    MS-Off Ver
    Excel 2007
    Posts
    2,573

    Re: Index Match Function

    Hello & Welcome to the Board,

    Can we see the formula you are using?

    If see it being something like...

    =INDEX($B$2:$J$20,MATCH("CA",A2:A20,0),MATCH(2011,$B$1:$J$1,0))
    HTH
    Regards, Jeff

    If you like the answer(s) provided, why not add some reputation by clicking the * below
    Please use [ Code ] tags when posting [ /Code ]
    Please view/read the Forum rules --- How to mark a thread as solved

  3. #3
    Registered User
    Join Date
    06-19-2011
    Location
    PA
    MS-Off Ver
    Excel 2010(Win)/2011(Mac)
    Posts
    9

    Re: Index Match Function

    Thanks,

    Of course,

    =INDEX(unemp!$M$20626:$M$21632,MATCH(us_data!A2,unemp!$B$20626:$B$21632,0),MATCH(us_data!C2,unemp!$D $20626:$D$21632,0))

    Hopefully I am just missing something obvious and easy.

  4. #4
    Forum Guru jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    San Antonio, TX
    MS-Off Ver
    Excel 2007
    Posts
    2,573

    Re: Index Match Function

    Maybe this...

    =INDEX(unemp!$M$20626:$M$21632,MATCH(1,(us_data!A2=unemp!$B$20626:$B$21632)*(us_data!C2=unemp!$D$206 26:$D$21632),0))

    IMPORTANT
    This is an array formula
    Enter the formula >> press F2 then >> CTRL + SHIFT + ENTER
    If entered correctly, the formula will be enclosed in {brackets}
    Do not enter the {brackets} manually

    If this does not do it then please attach a small sample workbook with what you have and what you expect.
    HTH
    Regards, Jeff

    If you like the answer(s) provided, why not add some reputation by clicking the * below
    Please use [ Code ] tags when posting [ /Code ]
    Please view/read the Forum rules --- How to mark a thread as solved

  5. #5
    Registered User
    Join Date
    06-19-2011
    Location
    PA
    MS-Off Ver
    Excel 2010(Win)/2011(Mac)
    Posts
    9

    Re: Index Match Function

    It didn't work and I entered it as you said and the brackets came up.

    Here is a sample of what I am trying to do, I tried to use the function in the sample and it kind of works, you'll see I guess.

    You can see in the sample that I am trying to grab the unemployment data for each state from a list of unemployment data for states and cities. Worst come to worse I could filter out the cities, there are just quite a few and I am trying to learn different features of excel so I thought this would be a better option.

    Thank you a lot for your help too.
    Attached Files Attached Files

  6. #6
    Forum Guru jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    San Antonio, TX
    MS-Off Ver
    Excel 2007
    Posts
    2,573

    Re: Index Match Function

    Give this a try...

    http://xl-central.com/lookup-multiple-criteria.html
    Attached Files Attached Files
    HTH
    Regards, Jeff

    If you like the answer(s) provided, why not add some reputation by clicking the * below
    Please use [ Code ] tags when posting [ /Code ]
    Please view/read the Forum rules --- How to mark a thread as solved

  7. #7
    Registered User
    Join Date
    06-19-2011
    Location
    PA
    MS-Off Ver
    Excel 2010(Win)/2011(Mac)
    Posts
    9

    Re: Index Match Function

    Here is what I am putting in now to match my workbook

    =INDEX(unemp!$M$20626:$M$21632,MATCH(1,IF(unemp!B20626:B21632=A2,IF(unemp!D20626:D21632=C2,1)),0))

    The only thing that I don't know the purpose of is the 1 in MATCH(1... I also haven't changed everything that should be to absolute yet but I am just trying to get it to work in the one cell for now.

    EDIT: Sorry I didn't see the link you posted, I'm taking a look at it now.

    EDIT 2: Also I did use CTRL+SHIFT+ENTER and got the brackets and am getting #VALUE! back.
    Last edited by yoss15; 06-19-2011 at 10:22 PM.

  8. #8
    Forum Guru jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    San Antonio, TX
    MS-Off Ver
    Excel 2007
    Posts
    2,573

    Re: Index Match Function

    I see you are using A2 and C2, but on the first post you had us_data!C2.

    Some reason you cannot attach the workbook where you are trying this formula?

    The MATCH(1 part you asked about is returning the position on the match so it can get passed to the Index function and return the result.

    The best way to disect a formula is by using Evaluate formula.

    Formula tab >> Formula Auditing >> Evaluate formula

    By doing this you can step through the formula seeing what happens in the different stages.
    HTH
    Regards, Jeff

    If you like the answer(s) provided, why not add some reputation by clicking the * below
    Please use [ Code ] tags when posting [ /Code ]
    Please view/read the Forum rules --- How to mark a thread as solved

  9. #9
    Registered User
    Join Date
    06-19-2011
    Location
    PA
    MS-Off Ver
    Excel 2010(Win)/2011(Mac)
    Posts
    9

    Re: Index Match Function

    When I selected the cells this time it just put A2 and C2 for some reason.

    No, haha I should have thought of that sooner.

    For some reason it is 2.3 megabytes, I think it happened when I pasted a table from Wikipedia that had the flags for each state. I removed all the pictures using a macro I found online so I'm not sure.

    Anyway I had to sugarsync it,

    https://www.sugarsync.com/pf/D943628_82_6160628358

    It is in the first workbook, the unemployment column.

  10. #10
    Forum Guru jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    San Antonio, TX
    MS-Off Ver
    Excel 2007
    Posts
    2,573

    Re: Index Match Function

    Look at column D on the unemp tab. Notice the little green triangle top left corner. This usually means the cell is a number masquerading as text.

    Put a zero in some cell off to the side and copy. Hightlight the range of years in column D >> right click paste special >> Add >> OK

    This will take care of converting the text to number.

    After converting the text to number everything worked fine, just don't forget the Ctrl + Shift + Enter.

    If you might have a suspicion two cells don't match, in a cell off to the side enter =D20627=us_data!C2

    This should result in False telling you the 1992 for Alabama does not match 1992 on the us_data tab.
    Last edited by jeffreybrown; 06-19-2011 at 11:20 PM.
    HTH
    Regards, Jeff

    If you like the answer(s) provided, why not add some reputation by clicking the * below
    Please use [ Code ] tags when posting [ /Code ]
    Please view/read the Forum rules --- How to mark a thread as solved

  11. #11
    Registered User
    Join Date
    06-19-2011
    Location
    PA
    MS-Off Ver
    Excel 2010(Win)/2011(Mac)
    Posts
    9

    Re: Index Match Function

    Thank you so much for your help! I got it to work as well.

    After fixing that I am trying to get what I was originally trying to use to work but keep getting a #REF! error.

    Any reason you can see why really quick? I am just trying to see so I can learn, this is my first time using this function so I'm curious if the logic is necessary.

  12. #12
    Forum Guru jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    San Antonio, TX
    MS-Off Ver
    Excel 2007
    Posts
    2,573

    Re: Index Match Function

    Are you talking about what you posted in post #3?

    =INDEX(unemp!$M$20626:$M$21632,MATCH(us_data!A2,unemp!$B$20626:$B$21632,0),MATCH(us_data!C2,unemp!$D $20626:$D$21632,0))

    If so, this formula will not work the way you have it structured.

    When using the Index and Match function it typically is used like INDEX(array,row_num,column_num)

    That is, you match row and column, but you want to match row against row.
    HTH
    Regards, Jeff

    If you like the answer(s) provided, why not add some reputation by clicking the * below
    Please use [ Code ] tags when posting [ /Code ]
    Please view/read the Forum rules --- How to mark a thread as solved

  13. #13
    Registered User
    Join Date
    06-19-2011
    Location
    PA
    MS-Off Ver
    Excel 2010(Win)/2011(Mac)
    Posts
    9

    Re: Index Match Function

    OK, I thought that would be a problem.

    I will use the IF function to do row against row then.

    Thanks again for your help.

  14. #14
    Forum Guru jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    San Antonio, TX
    MS-Off Ver
    Excel 2007
    Posts
    2,573

    Re: Index Match Function

    You're very welcome...glad it worked for you

    If you are satisfied with the answer provided, please don’t forget to mark the thread as solved.

    How to mark a thread Solved
    Go to the first post
    Select
    -- Edit
    -- Go Advanced
    -- Below the word Title you will see a dropdown with the word No prefix
    -- Update to Solved and then select Save
    HTH
    Regards, Jeff

    If you like the answer(s) provided, why not add some reputation by clicking the * below
    Please use [ Code ] tags when posting [ /Code ]
    Please view/read the Forum rules --- How to mark a thread as solved

  15. #15
    Registered User
    Join Date
    06-19-2011
    Location
    PA
    MS-Off Ver
    Excel 2010(Win)/2011(Mac)
    Posts
    9

    Re: Index Match Function

    So I ran into a problem. After looking through the numbers I was getting I realized that it just seems to be returning the numbers in the order they are in on the unemployment sheet.

    So I am getting numbers for 1991 returned for 1992 because 91 is the first cell indexed.
    So I tried this,

    =INDEX(unemp!$M$20632:$M$21637,MATCH(A7,unemp!$B$20632:$B$21637,0)*MATCH(us_data!C7,unemp!$D$20632:$ D$21637,0),0)

    It works all throughout Alabama but once it gets to Alaska it starts returning numbers and I have no clue where they are coming from.

    Also looking back I think I was entering the logic form in wrong by forgetting to put in the Match function but once I did that I still was unable to get it to work.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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.2.0