+ Reply to Thread
Results 1 to 8 of 8

Lookup with THREE conditions: one vertical, two horizontal

  1. #1
    Registered User
    Join Date
    05-09-2012
    Location
    USA
    MS-Off Ver
    2019 16.0.13205.200000 64-bit
    Posts
    61

    Question Lookup with THREE conditions: one vertical, two horizontal

    Guys, I'm wondering if anyone knows how to do that. I have a table where I need to return a value according to THREE conditions:
    1. Vertical, which is a shop code for instance
    2. And 2 horizontal:
    - One: segment (heading level 1)
    - Two: product (heading level 2)

    E.g. for "Shop1", what's the value for segment "PI" and product "Credit", etc.
    An example file's attached.

    The key thing for me is to do this WITHOUT changing data structure, because that really would be a huge pain. I mean, if it's no possible to do without changes (e.g. adding an extra column, etc.), I'll have to live with that I guess. But ideally I would really like to avoid changing data structure.



    Thanks so much in advance!
    Attached Files Attached Files
    Last edited by splendidus; 05-23-2012 at 02:47 AM.
    Office 2019 16.0.13205.200000 64-bit

  2. #2
    Valued Forum Contributor
    Join Date
    02-08-2012
    Location
    wales
    MS-Off Ver
    Excel 2007
    Posts
    964

    Re: Lookup with THREE conditions: one vertical, two horizontal

    fz73m5zEmZS6Y14-C.xlsx

    here you go. index and match result
    Last edited by twiggywales; 05-23-2012 at 02:57 AM.
    The Importance of INDEX - A GUIDE TO INDEX'S OTHER USES
    <--- If a post helps hit the star

  3. #3
    Valued Forum Contributor
    Join Date
    02-08-2012
    Location
    wales
    MS-Off Ver
    Excel 2007
    Posts
    964

    Re: Lookup with THREE conditions: one vertical, two horizontal

    how it works

    Please Login or Register  to view this content.
    match finds the specified value in a series and values its location.

    match(A11(the shop you want to find),A3:A7(your list of shops),0(shows exact result))

    same with your PI or Affluent

    index returns the specific value of a cell requested in an array

    index(B3:C4(your values),match 1,match 2)

  4. #4
    Registered User
    Join Date
    05-09-2012
    Location
    USA
    MS-Off Ver
    2019 16.0.13205.200000 64-bit
    Posts
    61

    Re: Lookup with THREE conditions: one vertical, two horizontal

    Quote Originally Posted by twiggywales View Post
    Attachment 157462

    here you go. index and match result
    Thanks so much for the reply! However, it actually doesn't quite do what I need it to. It matches by only two conditions (that I managed to do myself as well): one vertical, and one horizontal - two, but not three. What I need it to do is match by THREE. For instance:
    - For "Shop1" (vertical)
    - For segment "PI" (horizontal)
    - For product "Credit" (horizontal)
    Two horizontal must match, then matching with vertical.

    The reason is simple: I have multiple product values (e.g. many matches for "Credit"), and the only difference is the segment value (e.g. PI, Affluent, Private, etc.). So many segments have the same products in them and those product values for each of the segments are different. That's why I need to match by TWO conditions vertically, not just one.
    Have a look at the updated file: if you match by Shop1 vertically and PI horizontally, it will return TWO values (5 and 55) for this lookup. And I need to further narrow it down (and hence choosing the right ONE result from that) by adding an extra horizontal condition (e.g. shop1, pi, credit = 5). Hope it's clear(er) now.

    Any help with that?
    Attached Files Attached Files
    Last edited by splendidus; 05-23-2012 at 03:27 AM.

  5. #5
    Valued Forum Contributor
    Join Date
    02-08-2012
    Location
    wales
    MS-Off Ver
    Excel 2007
    Posts
    964

    Re: Lookup with THREE conditions: one vertical, two horizontal

    bit more tricky but this works

    Please Login or Register  to view this content.
    its an array so needs to be entered with control+shift+enter


    fz73m5zEmZS6Y14-C_v2-C.xlsx

  6. #6
    Registered User
    Join Date
    05-09-2012
    Location
    USA
    MS-Off Ver
    2019 16.0.13205.200000 64-bit
    Posts
    61

    Re: Lookup with THREE conditions: one vertical, two horizontal

    Quote Originally Posted by twiggywales View Post
    bit more tricky but this works

    Please Login or Register  to view this content.
    its an array so needs to be entered with control+shift+enter


    Attachment 157478
    Worked like a charm, and absolutely solved the issue I was having! I really am eternally thankful! Thank you SO, SO much!!!

  7. #7
    Valued Forum Contributor
    Join Date
    02-08-2012
    Location
    wales
    MS-Off Ver
    Excel 2007
    Posts
    964

    Re: Lookup with THREE conditions: one vertical, two horizontal

    Np glad I could help

  8. #8
    Registered User
    Join Date
    08-05-2014
    Location
    Canada
    MS-Off Ver
    2010
    Posts
    1

    Re: Lookup with THREE conditions: one vertical, two horizontal

    i know this is old... but this is the exact situation i need help with. When i open the spreadsheet the formula is providing the right answer, but once i click on the formula it shows only "check" after, not the value. When i try to replicate the formula in my own spreadsheet it also is returning just "check" vs. the value. Any explanation on what i may be doing wrong?

  9. #9
    Registered User
    Join Date
    08-05-2014
    Location
    Canada
    MS-Off Ver
    2010
    Posts
    1

    Re: Lookup with THREE conditions: one vertical, two horizontal

    Nevermind -- I see the comment "its an array so needs to be entered with control+shift+enter"
    if you are trying to do for a large dataset -- do you have to "control+shift+enter" every cell or is there an easier way to copy/paste the formula?

+ 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.6.0 RC 1