+ Reply to Thread
Results 1 to 16 of 16

index/match problem

  1. #1
    Registered User
    Join Date
    04-23-2012
    Location
    Oakland, California
    MS-Off Ver
    Excel 2007
    Posts
    32

    index/match problem

    Hi,

    I'm trying to do an index match formula to look up a name and number in a pivot table but the two values I'm looking up and concatenate are in the same row:

    {=INDEX(A:B,MATCH(H5&I4,A:A&A:A,0),2)}

    So in this formula, I'm trying to find a total sum in a two column pivot table that matches two criteria in H5 and I4 and searching for those two values in the same column of the pivot table (column A).

    It's giving me an #N/A value.

    Any suggestions?

  2. #2
    Valued Forum Contributor wenqq3's Avatar
    Join Date
    04-01-2013
    Location
    Malaysia
    MS-Off Ver
    Excel 2003
    Posts
    868

    Re: index/match problem

    Can you attach a worksheet, with some sample data. So we can work on it. Thanks
    -If the problem is solved, please mark your thread as Solved: Click Thread Tools above your first post, select "Mark your thread as Solved".

    -Always upload a workbook before start your question
    To attach a file, push the button with the paperclip (or scroll down to the Manage Attachments button), browse to the required file, and then push the Upload button.

    +++ If my answer(s) helped you, please add me reputation by click on * +++

  3. #3
    Registered User
    Join Date
    04-23-2012
    Location
    Oakland, California
    MS-Off Ver
    Excel 2007
    Posts
    32

    Re: index/match problem

    In the attached example, Im trying to get the volume count from the first pivot table for Family Practice for Week 13 (11) and get this value in cell I5. Let me know if you have any questions about this. Thank you!
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    04-23-2012
    Location
    Oakland, California
    MS-Off Ver
    Excel 2007
    Posts
    32

    Re: index/match problem

    In the attached example, Im trying to get the volume count from the first pivot table for Family Practice for Week 13 (11) and get this value in cell I5. Let me know if you have any questions about this. Thank you!
    Attached Files Attached Files

  5. #5
    DaveDeV
    Guest

    Re: index/match problem

    Hi PMA,

    A pivot table is NOT an array within a spreadsheet - it is a summary display comprising extracted elements of a memory array. Each value in a pivot table is accessed by coordinates based on the active row and column header fields plus some other guff.

    As a result, it is not possible to use any of the LOOKUP/INDEX/MATCH functions with the target array being a pivot table.

    What you need to do is to create a "mirror table" outside the bounds of the pivot table and then use your LOOKUP/INDEX/MATCH functions to retrieve values from a "real" Excel data array by referencing the "mirror table".

    If you don't plan to refresh the pivot table to take into account new data in the source data table, then it is possible to use "entered" relative references to populate the mirror table (i.e. don't try to use "=" and, using the mouse, select a value in the pivot table, which will just generate a "GETPIVOTDATA" function string - if the location of the pivot data value element is depicted as being in B6, then enter the full function as "=B6" by typing all three characters). If, however, you will be refreshing the pivot table with additional data, then the use of "=B6" will result in an unpredictable "fetch" as the target value may have moved. This is when you will need to use GETPIVOTDATA functions to guarantee the fetch irrespective of any changes in the pivot table due to a refresh after changes in the source data table.

    For details on how to access values within pivot tables, I strongly suggest you nip into YouTube and search for "Excel 2007 Pivot Table Tutorial" then watch a few to get an idea on how to effectively use GETPIVOTDATA (it's a bit of a dog as you can't copy the formulae - you have to enter each instance as the reference is NOT to an Excel data cell, but to an X:Y coordinate in a table.

    Apologies - I know this is probably not what you wanted to hear...

    PS: It is possible to de-activate the GETPIVOTDATA function, but then you have no way to fetch any coordinate-based value after a refresh that shifts coordinate locations.

    Dave
    Last edited by DaveDeV; 05-23-2013 at 01:52 PM.

  6. #6
    Forum Contributor
    Join Date
    09-11-2009
    Location
    Paris
    MS-Off Ver
    Excel 2003
    Posts
    102

    Re: index/match problem

    Hi,
    Attached file for your reference,


    P/S: I used an array formula confirmed with Ctrl+shift+Enter!
    Hope this helps!
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    04-23-2012
    Location
    Oakland, California
    MS-Off Ver
    Excel 2007
    Posts
    32

    Re: index/match problem

    Hi Dave,

    Thanks for your reply. I created a new source table array using "=C6" etc. and used that and now I get a value error
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    04-23-2012
    Location
    Oakland, California
    MS-Off Ver
    Excel 2007
    Posts
    32

    Re: index/match problem

    Wow, thank you so much. Would it be possible to explain what you did in laymen's terms? If not, no big deal. I appreciate your help.

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

    Re: index/match problem

    I put this formula in I5:

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


    Note that the second and third range is offset by one cell from the first range. In other columns it is offset by 2, 3, and 4 cells. Those formulae can be copied down to row 9, and in I10 I have this formula:

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


    which is copied across.

    Hope this helps.

    Pete
    Attached Files Attached Files

  10. #10
    Registered User
    Join Date
    04-23-2012
    Location
    Oakland, California
    MS-Off Ver
    Excel 2007
    Posts
    32

    Re: index/match problem

    Thank you, Pete_UK!!!

    One question: I tried extending the rows for column A and B down to 500 because the pivot table length could end up being longer in different iterations of this report. However, when I changed it down to include blank rows before the pivot table, it gives me an error. Any suggestions?

    Thanks again!

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

    Re: index/match problem

    Maybe you didn't do it right. Highlight cells I5 to L5 on the original file, then CTRL-H, and:

    Find what $25
    Replace with $55
    Click Replace All

    That should be 12 replacements, and now the ranges go up to 550 rows. Copy those formulae down to row 9.

    Hope this helps.

    Pete

  12. #12
    Registered User
    Join Date
    04-23-2012
    Location
    Oakland, California
    MS-Off Ver
    Excel 2007
    Posts
    32

    Re: index/match problem

    Hi Pete,

    Sorry to bug you again. This might not be possible given the constraints of the sumproduct but the formula needs to accomodate changes in the department and week number availability for every reporting period. So for example, if I replace Family Practice with Parking in the table on the right, it needs to populate with 1 for week 13, 4 for week 15, and 2 for week 16 which corresponds to the counts for parking in the pivot table. Like I said, I'm not sure if this is possible, but I appreciate your help anyways. Thanks!

  13. #13
    Registered User
    Join Date
    04-23-2012
    Location
    Oakland, California
    MS-Off Ver
    Excel 2007
    Posts
    32

    Re: index/match problem

    Hi Dave,

    I was able to create a new array based on the pivot table, and changed the equation to match this new array:

    =INDEX(C5:D500,MATCH(J5&K4,$C$5:$C$500&$C$5:$C$500,0),2)

    I am getting a value error. Do you have any suggestions?
    Attached Files Attached Files

  14. #14
    DaveDeV
    Guest

    Re: index/match problem

    Hi PMA,

    I was about to suggest you try something before getting too far down a route that might have problems...

    Go back to your source data table and add in some records that will result in a new category and a few rows to populate your pivot table, then refresh the pivot table and see if the injected extra category + rows screws up your results in the MATCH logic by changing the coordinates of the referenced values.

    If it does, you have a major challenge - you're going to have to investigate the GETPIVOTDATA option (with all that that entails).

    I have not been able to find any reference to using Array Formulae to reference the data values in a pivot table but my guess is that Array Formulae only work with "genuine" Excel cell ranges and not mapped data from pivot tables. To illustrate this, generate a simple pivot table with 5 or 6 rows and add some formulae into a row located 2 rows below the base of the pivot table. Then add some data to the source table and refresh and the expanded pivot table will not result in the formula row being shifted down, it will just be overwritten by the mapped pivot table.

    Sorry mate...

    Dave

  15. #15
    DaveDeV
    Guest

    Re: index/match problem

    By injecting nested IFERROR tests each with unique error codes, it appears that the INDEX is failing with a value error but the MATCH is not failing, but is the cause of the error with INDEX. All I can think of is that the MATCH is returning a value that pushes the INDEX out of the range - but I can't be 100% sure.

    Sorry...

  16. #16
    Registered User
    Join Date
    04-23-2012
    Location
    Oakland, California
    MS-Off Ver
    Excel 2007
    Posts
    32

    Re: index/match problem

    I actually was able to retrieve this data by doing a sumif function in the raw data source. Thanks!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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