+ Reply to Thread
Results 1 to 7 of 7

Complex Lookup - pivot problem?

  1. #1
    Registered User
    Join Date
    11-09-2012
    Location
    Canada
    MS-Off Ver
    Excel 2010
    Posts
    16

    Complex Lookup - pivot problem?

    I need help with an advanced Lookup. I’ve done a search for something similar and can’t find anything. Sorry in advance if this is easy for some.

    See enclosed example file. The function I’m looking for is for the "Summary – 3 counties" sheet. Line by line, I look for the MAX number (I can do that) and according to where it is, it would then go to that particular corresponding sheet (I can do that), that particular corresponding line (according to species) and same MAX number and return the header in that same column. For example, for "Montezuma Quail", the MAX would return 7.045. The function would then lookup in the "Pima" sheet on the "Montezuma Quail" line for 7.045 and return the header of "Madera Canyon--Proctor Rd.". Any ideas how I can do this in one line? Is this what is called a pivot? Or will this require a bit of VBA of which I know nothing?

    Thanks.
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    11-26-2013
    Location
    Colac, Victoria, Australia
    MS-Off Ver
    Excel 2016
    Posts
    1,309

    Re: Complex Lookup - pivot problem?

    Hi gapollo,

    No it isn't a Pivot Table issue!

    I don't understand what you are trying to achieve, but this formula might give you a clue. In cell E2, it gives you the answer you wanted.

    =INDEX(Pima!$B$1:$EQ$1,0,MATCH($C2,INDIRECT("Pima!$B$" & MATCH(A2,Pima!$B$1:$B$147,0) & ":$EQ$" & MATCH(A2,Pima!$B$1:$B$147,0)),0))

    I'm sure this is just the first step!

    This is already a complex formula - if you take it further, I would recommend using some helper columns.

    Is your plan to have the second best (Cochise) on column F and get Huachuca Canyon?

    Don't have time at the moment to do more, but let me know how this goes, and will have a look tomorrow.

    Regards,

    David


    When you reply please make it clear WHO you are responding to by mentioning their name.

    If this has been of assistance, please advise. A little thanks goes a long way.
    - Please click on the *Add Reputation button at the bottom of helpful responses.

    Please mark your thread as SOLVED:
    - Click Thread Tools above your first post, select "Mark your thread as Solved".

  3. #3
    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. 2405 (Windows 11 23H2 64-bit)
    Posts
    81,408

    Re: Complex Lookup - pivot problem?

    Quote Originally Posted by David A Coop View Post
    I don't understand what you are trying to achieve, but this formula might give you a clue. In cell E2, it gives you the answer you wanted.

    =INDEX(Pima!$B$1:$EQ$1,0,MATCH($C2,INDIRECT("Pima!$B$" & MATCH(A2,Pima!$B$1:$B$147,0) & ":$EQ$" & MATCH(A2,Pima!$B$1:$B$147,0)),0))

    [/COLOR][/SIZE]
    May I suggest this slight amendment:

    =INDEX(Pima!$B$1:$EQ$1,0,MATCH(LARGE($B2:$D2,1),INDIRECT("Pima!$B$" & MATCH(A2,Pima!$B$1:$B$147,0) & ":$EQ$" & MATCH(A2,Pima!$B$1:$B$147,0)),0))

    The section in red could be adapted to find the second best hotspot, if I have understood the requirement correctly.

    The following would eradicate error messages:

    =IFERROR(INDEX(Pima!$B$1:$EQ$1,0,MATCH(LARGE($B3:$D3,1),INDIRECT("Pima!$B$" & MATCH(A3,Pima!$B$1:$B$147,0) & ":$EQ$" & MATCH(A3,Pima!$B$1:$B$147,0)),0)),"")
    Last edited by AliGW; 03-07-2014 at 06:31 AM.
    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.

  4. #4
    Registered User
    Join Date
    11-09-2012
    Location
    Canada
    MS-Off Ver
    Excel 2010
    Posts
    16

    Re: Complex Lookup - pivot problem?

    David Coop,

    Thanks for the ideas. I have been able to engineer something out from this so that everything is automatic.
    As it happens, you guessed right about my wanting the second best in the next column and I've been able to work that out as well.
    Your help was much appreciated!

  5. #5
    Registered User
    Join Date
    11-09-2012
    Location
    Canada
    MS-Off Ver
    Excel 2010
    Posts
    16

    Re: Complex Lookup - pivot problem?

    AliGW,

    As suggested, I had already adapted both the "LARGE" idea as well as the "IFERROR" idea into my second column before seeing the suggestions. Thank you - it will greatly help others.

  6. #6
    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. 2405 (Windows 11 23H2 64-bit)
    Posts
    81,408

    Re: Complex Lookup - pivot problem?

    You're welcome!

  7. #7
    Forum Expert
    Join Date
    11-26-2013
    Location
    Colac, Victoria, Australia
    MS-Off Ver
    Excel 2016
    Posts
    1,309

    Re: Complex Lookup - pivot problem?

    You're welcome gapollo, and thanks for the Rep.

    DAC

+ 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: 02-03-2014, 12:47 AM
  2. [SOLVED] Complex LOOKUP problem
    By adm0104 in forum Excel Formulas & Functions
    Replies: 13
    Last Post: 06-07-2013, 11:29 AM
  3. Complex Request with Pivot Tables and copying pivot data to new page with formulas
    By Obsessed in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-07-2013, 09:16 AM
  4. True/false problem with lookup list/pivot table data
    By Onestopfanshop in forum Excel General
    Replies: 3
    Last Post: 05-15-2009, 03:42 PM
  5. [SOLVED] Complex LookUp / Match Problem ??
    By carl in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 05-02-2005, 04:06 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