+ Reply to Thread
Results 1 to 12 of 12

Lookup/Index-Match-Match using segments

  1. #1
    Forum Contributor
    Join Date
    12-02-2008
    Location
    Brisbane
    MS-Off Ver
    2016
    Posts
    811

    Lookup/Index-Match-Match using segments

    Is it possible to return a value or a sum of values using segmented lookup criteria. The Sample 1 spreadsheet (attached) explains it better.

    Grateful for any ideas.

    Thanks
    Attached Files Attached Files
    Last edited by BRISBANEBOB; 06-10-2009 at 03:06 AM.

  2. #2
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Lookup/Index-Match-Match using segments

    You could use a SUMPRODUCT such that:

    Please Login or Register  to view this content.
    This isn't a great approach, elegant but not particularly efficient.

    I would personally advise you create a concatenation of B:D in A such that:

    Please Login or Register  to view this content.
    Then you can dispense with SUMPRODUCT and use a standard SUMIF which is far more efficient in the long run

    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    12-02-2008
    Location
    Brisbane
    MS-Off Ver
    2016
    Posts
    811

    Re: Lookup/Index-Match-Match using segments

    Once again I find myself thanking you. Also for your list of reading material.

    What part does the ISNUMBER play in the SUMPRODUCT formula?

  4. #4
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Lookup/Index-Match-Match using segments

    It is used to evaluate the result of the SEARCH.

    A SEARCH function will return a number if the criteria string is found - if not it will return an Error.

    The ISNUMBER is used to manipulate the output of the SEARCH to a Boolean of True/False. If found and Search returned a Number the ISNUMBER returns TRUE, if not found and Search returned an Error value then ISNUMBER returns FALSE.

    The Boolean output of the ISNUMBER is then coerced via double unary (--) to it's integer equivalent of 1 for TRUE and 0 for FALSE. These integers are subsequently used when calculating the Product.

  5. #5
    Valued Forum Contributor squiggler47's Avatar
    Join Date
    02-17-2009
    Location
    Littleborough, UK
    MS-Off Ver
    Excel 3.0 to 2007+2010! (couldnt get 2.1 working)
    Posts
    1,013

    Re: Lookup/Index-Match-Match using segments

    You could try this

    I assumed blank cell means any character?

    Please Login or Register  to view this content.
    copied down!
    Regards
    Darren

    Update 12-Nov-2010 Still job hunting!

    If you are happy with the results, please add to our reputation by clicking the blue scales icon in the blue bar of the post.

    Learn something new each day, Embrace change do not fear it, evolve and do not become extinct!


  6. #6
    Forum Contributor
    Join Date
    12-02-2008
    Location
    Brisbane
    MS-Off Ver
    2016
    Posts
    811

    Re: Lookup/Index-Match-Match using segments

    I've used formula with the double unary and I sort of understand the way it works. I also understand (now that I've worked through the formula and read your response) how the ISNUMBER works. Why do some formula use the -- when your's doesnt need to?

  7. #7
    Forum Contributor
    Join Date
    12-02-2008
    Location
    Brisbane
    MS-Off Ver
    2016
    Posts
    811

    Re: Lookup/Index-Match-Match using segments

    To Squiggler47

    That's also pretty neat!

    Thanks

  8. #8
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Lookup/Index-Match-Match using segments

    Sorry my bad - was on double unary auto pilot... doh.

    In this instance we used * rather than -- as our coercer, put simply this is because in this instance our ranges are not of equal dimension, ie:

    6x1
    B4:B9, C4:C9, D4:D9

    6x6
    E4:J9

    1x6
    E3:J3

    so a double unary approach is not viable here... when it is viable it is normally used as it's regarded as slightly more efficient... there are pros and cons to both methods (-- and *) ... the link in the Sig offers more info on the subject.

  9. #9
    Forum Contributor
    Join Date
    12-02-2008
    Location
    Brisbane
    MS-Off Ver
    2016
    Posts
    811

    Re: Lookup/Index-Match-Match using segments

    OK, with you.

    Thanks again.

  10. #10
    Valued Forum Contributor squiggler47's Avatar
    Join Date
    02-17-2009
    Location
    Littleborough, UK
    MS-Off Ver
    Excel 3.0 to 2007+2010! (couldnt get 2.1 working)
    Posts
    1,013

    Re: Lookup/Index-Match-Match using segments

    Just as a reference with this sheet all the formulas are fairly close in speed!

    I also tried a mod of the sum if formula

    RIGHT("*"&B15&":",2)&RIGHT("*"&C15&":",2)&RIGHT("*"&D15,1)

    Rather than

    IF($B15="","*",$B15)&":"&IF($C15="","*",$C15)&":"&IF($D15="","*",$D15)

  11. #11
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Lookup/Index-Match-Match using segments

    SUMIF will be considerably quicker than Sumproduct/Array when used with very large ranges and/or in very large quantities (amplified if used in Volatile fashion) ... if the datasets are insignificant in size then there won't be a massive difference I agree.

+ 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