+ Reply to Thread
Results 1 to 13 of 13

Lookup In "Split" Ranges As In One

  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 In "Split" Ranges As In One

    I have a situation. I need to perform a HLOOKUP and, let's say, find a Top 5 largest values in a row. The issue is that my data is structured something like this:
    A B C D E F G H I J K L
    # # # S # # # S # # # S ...etc

    Each # is a numeric value, and S are their sums. Needless to say that I don't want to do a lookup in the whole A:L range, since sums will show up as top values. So what I want to do is to perform a lookup ignoring the sums, meaning in ranges: A:C,E:G,I:K. So it's like making a new "unified" range out of several small pieces. But this should be done within one formula, of course.

    Is anything like this possible by any chance, guys/gals?
    Thanks so much in advance!
    Last edited by splendidus; 05-10-2012 at 02:48 AM.
    Office 2019 16.0.13205.200000 64-bit

  2. #2
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,887

    Re: Lookup In "Split" Ranges As In One

    Hi Splendidus,

    Assuming the data is in A1:L1 (with sums in D1, H1 and L1), try this array formula (confirmed using CTRL+SHIFT+ENTER, not just ENTER):

    =LARGE(IF(MOD(COLUMN($A$1:$L$1),4)<>0,$A$1:$L$1),ROW(A1))

    Fill that down five rows to get the first through fifth larges values. (The "ROW(A1)" bit will update to A2, A3, A4 and A5, returning 1 through 5, respectively.)

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

    Re: Lookup In "Split" Ranges As In One

    Quote Originally Posted by Paul View Post
    Hi Splendidus,

    Assuming the data is in A1:L1 (with sums in D1, H1 and L1), try this array formula (confirmed using CTRL+SHIFT+ENTER, not just ENTER):

    =LARGE(IF(MOD(COLUMN($A$1:$L$1),4)<>0,$A$1:$L$1),ROW(A1))

    Fill that down five rows to get the first through fifth larges values. (The "ROW(A1)" bit will update to A2, A3, A4 and A5, returning 1 through 5, respectively.)
    Thanks so much, Paul! The thing however is that total columns are not always every Nth column. Here's a sample file attached to illustrate my point. I'd very much appreciate any help on this!
    Attached Files Attached Files

  4. #4
    Valued Forum Contributor
    Join Date
    02-12-2011
    Location
    The Netherlands
    MS-Off Ver
    365
    Posts
    860

    Re: Lookup In "Split" Ranges As In One

    Arrayformula:
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Harry.

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

    Question Re: Lookup In "Split" Ranges As In One

    Quote Originally Posted by HSV View Post
    Arrayformula:
    Please Login or Register  to view this content.
    Thanks so much for your reply! It does help, but apparently I need a tad more functionality than that. I did get the formula to work in my case, but it's just I need a bit more of a twist: I thought I could get the necessary effect once I get the formula you recommended to work, but I can't.
    So, to illustrate the issue better, have a look at the attached file.

    The functionality needed is the following:
    1. User inputs a code
    2. Based on that code a vertical lookup is done
    3. After that in that found row (step above) a horizontal lookup is done, looking for largest X value. This must EXCLUDE the total columns
    Let's say this is formula 1. Formula 2 is the same, but it need to return not largest X value, but a NAME of a largest X value. It also must exclude total columns as well needless to say.

    Is anything like this possible to do within the same formula? Or two, actually.
    Thanks so very much in advance!
    Attached Files Attached Files
    Last edited by splendidus; 05-29-2012 at 08:05 AM.

  6. #6
    Valued Forum Contributor
    Join Date
    02-12-2011
    Location
    The Netherlands
    MS-Off Ver
    365
    Posts
    860

    Re: Lookup In "Split" Ranges As In One

    Something like this ?
    Attached Files Attached Files

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

    Re: Lookup In "Split" Ranges As In One

    Quote Originally Posted by HSV View Post
    Something like this ?
    Not "something" like this, it's EXACTLY like this!!! :D

    But there's one "but" (as usual I guess). Here's the formula I adopted from yours (I put the value lookup formula INTO the product name lookup formula - merged them together):
    Please Login or Register  to view this content.
    For some reason this part "INDIRECT("DH"&MATCH($D$3,CodesColumn,0)&" returns a WRONG row number. For instance, let's say we're looking for a match for code 86. For some strange reason result returned for this is 76 (which then merged with DH giving DH76). Meaning after a lookup for 86, it returns that code 86 is in 76th row, and I honestly can't figure out why. As far as I understand the formula is looking for a row where code 86 is located, if so, it should return 122 (row 122), not 76.

    Any ideas on how this might be solved? I'll play with LOOKUP in the meanwhile
    In any case, thank you so very much for your kind help and time!!
    Last edited by splendidus; 05-30-2012 at 12:23 PM.

  8. #8
    Valued Forum Contributor
    Join Date
    02-12-2011
    Location
    The Netherlands
    MS-Off Ver
    365
    Posts
    860

    Re: Lookup In "Split" Ranges As In One

    Maybe you could upload your file.

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

    Re: Lookup In "Split" Ranges As In One

    Quote Originally Posted by HSV View Post
    Maybe you could upload your file.
    If I could, I most definitely would. I'll try to come up with an exactly-matching sample

  10. #10
    Valued Forum Contributor
    Join Date
    03-20-2011
    Location
    UK
    MS-Off Ver
    Excel 2007/10/16
    Posts
    840

    Re: Lookup In "Split" Ranges As In One

    Hi

    Hope this what you looking for.

    Please click on the attachment.
    Attached Files Attached Files
    To help you by my post? it would be nice to click on to say "Thank you".
    If you are happy with a solution to your problem?
    Click Thread Tools above your first post,
    select "Mark your thread as Solved".

  11. #11
    Forum Expert martindwilson's Avatar
    Join Date
    06-23-2007
    Location
    London,England
    MS-Off Ver
    office 97 ,2007
    Posts
    19,320

    Re: Lookup In "Split" Ranges As In One

    this array no helper needed
    =INDEX($A$2:$P$2,MATCH(LARGE(INDEX($A$2:$P$2<>"total",0)*INDEX($A$3:$P$3,0),ROW(A1)),INDEX($A$2:$P$2<>"total",0)*INDEX($A$3:$P$3,0),0))
    or with a helper see attached
    Attached Files Attached Files
    Last edited by martindwilson; 05-30-2012 at 07:52 PM.
    "Unless otherwise stated all my comments are directed at OP"

    Mojito connoisseur and now happily retired
    where does code go ?
    look here
    how to insert code

    how to enter array formula

    why use -- in sumproduct
    recommended reading
    wiki Mojito

    how to say no convincingly

    most important thing you need
    Martin Wilson: SPV
    and RSMBC

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

    Question Re: Lookup In "Split" Ranges As In One

    Quote Originally Posted by HSV View Post
    Maybe you could upload your file.
    Here's a sample, hope it's clearer now.
    The data on the Data sheet is in the EXACT format I must have it in, meaning there's little wiggle room when it comes to changing it.
    Also, putting a rank above would also not work as far as I understand, since I need a result returned for each single code (=formula should process rows where a code was looked up).

    I mean, the formula you originally suggested gave me exactly what I need, but for some reason it just doesn't work on the data structure that I have. Or maybe I'm just missing something here :/

    In any case, I'd much appreciate any help!
    Attached Files Attached Files

  13. #13
    Valued Forum Contributor
    Join Date
    02-12-2011
    Location
    The Netherlands
    MS-Off Ver
    365
    Posts
    860

    Re: Lookup In "Split" Ranges As In One

    Splendidus,
    Attached Files Attached Files

+ 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