+ Reply to Thread
Results 1 to 25 of 25

Find(/lookup) next value

  1. #1
    Registered User
    Join Date
    09-04-2014
    Location
    World
    MS-Off Ver
    2010
    Posts
    29

    Find(/lookup) next value

    Hi,

    I've been searching the web, and finally found a formula in mrexcel forum:
    http://www.mrexcel.com/forum/excel-q...ml#post2696961

    Could anyone here help me to add to this function?

    =IF(ROWS(F$2:F2)>E$2,"",INDEX(Value,SMALL(IF(Item=D$2,ROW(Item)),ROWS(F$2:F2))))

    It's currently one "item" and one lookup value (D2). I have a total of three "items" and three lookup values...

    Also, the values returned should ideally be sorted from largest by one of the "item"-ranges.

    Thanks in advance!

  2. #2
    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. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,903

    Re: Find(/lookup) next value

    Attach a sample workbook. Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.
    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.

  3. #3
    Registered User
    Join Date
    09-04-2014
    Location
    World
    MS-Off Ver
    2010
    Posts
    29

    Re: Find(/lookup) next value

    Sample workbook attached.
    Attached Files Attached Files

  4. #4
    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. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,903

    Re: Find(/lookup) next value

    This will get what you want into the list. I hope somebody else will be able to adapt it for you to get your list into the order you want (revenue large to small).

    In A5 confirmed with CTRL+SHIFT+ENTER and copied down:

    =IFERROR(INDEX(Data!$A$3:$A$20, SMALL(IF(COUNTIFS(Return!$B$1, Data!$E$3:$E$20, Return!$B$2, Data!$D$3:$D$20, Return!$B$3, Data!$C$3:$C$20), ROW(Data!$F$3:$F$20)-MIN(ROW(Data!$F$3:$F$20))+1), ROW(A1)), COLUMN(A1)),"")

    In B5 copied down:

    =IFERROR(VLOOKUP($A5,Data!$A$3:$F$20,2,0),"")

    In C5 copied down:

    =IFERROR(VLOOKUP($A5,Data!$A$3:$F$20,6,0),"")

  5. #5
    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. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,903

    Re: Find(/lookup) next value

    Thank you for the rep!

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.

  6. #6
    Registered User
    Join Date
    09-04-2014
    Location
    World
    MS-Off Ver
    2010
    Posts
    29

    Re: Find(/lookup) next value

    It works great. Thank you very much!

    I'll keep the post open for a bit, to see if there might be some suggestions on the sorting.

    Thanks again!

  7. #7
    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. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,903

    Re: Find(/lookup) next value

    Thanks for clarifying. If you had not responded here, then nobody would have come up with anything more, as it would have appeared as if you had left the thread hanging. It's always best to be very clear in the thread whether what you have been offered as a solution works and to what extent you might want it adapting.

  8. #8
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Find(/lookup) next value

    Hi,

    I believe this will return the layout you want.

    If you have Power Query available to you, it should be possible to make this more flexible.
    Attached Files Attached Files
    Last edited by xlnitwit; 07-21-2016 at 08:24 AM.
    Don
    Please remember to mark your thread 'Solved' when appropriate.

  9. #9
    Registered User
    Join Date
    09-04-2014
    Location
    World
    MS-Off Ver
    2010
    Posts
    29

    Re: Find(/lookup) next value

    Thank you very much!

  10. #10
    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. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,903

    Re: Find(/lookup) next value

    Quote Originally Posted by xlnitwit View Post
    Hi,

    I believe this will return the layout you want.
    Sorry for off-topic interjection:

    Although there is no official rule regarding this behaviour, we request that wherever possible both the question AND the answer be provided in substantive detail here within the thread. An attached workbook is an excellent aid for posing a question and offering a solution, but solely doing that with no in thread explanation makes it difficult for researchers to understand or consider the Q & A of this thread without downloading what may be a pointless doc to them, if they can do that at all. Doing that also hides the content from search engines so others may never benefit from this.

    I'm sure you understand, and we look forward to seeing you post your formulas/macros in your posts for the searching benefit of all.

    Thanks again for all your hard work here!

  11. #11
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Find(/lookup) next value

    Of course, I quite understand.

    An additional ranking column is added to the data sheet (truncated due to post length):
    Excel 2010 32 bit
    A
    B
    C
    D
    E
    F
    G
    2
    Number Name Location Industry Department Revenue Rank
    3
    1
    Mazda
    1
    shop right
    10
    =IF(F3="",COUNT($F$3:$F$20)+1,RANK(F3,$F$3:$F$20))+COUNTIF(F$2:F2,""&F3)
    4
    2
    Audi
    3
    garage left
    20
    =IF(F4="",COUNT($F$3:$F$20)+1,RANK(F4,$F$3:$F$20))+COUNTIF(F$2:F3,""&F4)
    5
    3
    Land Rover
    5
    street up
    =IF(F5="",COUNT($F$3:$F$20)+1,RANK(F5,$F$3:$F$20))+COUNTIF(F$2:F4,""&F5)
    Sheet: Data

    and then the layout on the Return sheet is this:
    Excel 2010 32 bit
    A
    B
    C
    D
    E
    F
    1
    List - Department right
    2
    List - Industry shop
    3
    Location
    1
    4
    Number Name Revenue (sort by largest) Counter Rank (DESC) Position
    5
    =IF($F5="","",INDEX(Data!A$3:A$20,$F5))
    =IF($F5="","",INDEX(Data!B$3:B$20,$F5))
    =IF($F5="","",INDEX(Data!F$3:F$20,$F5))
    =COUNTIFS(Data!$E$3:$E$20,Return!$B$1, Data!$D$3:$D$20, Return!$B$2,Data!$C$3:$C$20,Return!$B$3)
    =IF(ROWS(D$5:D5)>D$5,"",SMALL(IF(Data!$E$3:$E$20=B$1,IF(Data!$D$3:$D$20=Return!$B$2,IF(Data!$C$3:$C$20=Return!$B$3,Data!$G$3:$G$20))),ROWS(E$2:E2)))
    =MATCH(E5,Data!$G$3:$G$20,0)
    6
    =IF($F6="","",INDEX(Data!A$3:A$20,$F6))
    =IF($F6="","",INDEX(Data!B$3:B$20,$F6))
    =IF($F6="","",INDEX(Data!F$3:F$20,$F6))
    =IF(ROWS(D$5:D6)>D$5,"",SMALL(IF(Data!$E$3:$E$20=B$1,IF(Data!$D$3:$D$20=Return!$B$2,IF(Data!$C$3:$C$20=Return!$B$3,Data!$G$3:$G$20))),ROWS(E$2:E3)))
    =MATCH(E6,Data!$G$3:$G$20,0)
    Sheet: Return
    Last edited by xlnitwit; 07-21-2016 at 08:23 AM.

  12. #12
    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. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,903

    Re: Find(/lookup) next value

    That's a lot of helper columns!

    I notice there are duplicates in the ranking list on the data tab: is this not potentially a problem with a longer list?

  13. #13
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Find(/lookup) next value

    I have in fact just corrected the ranking formula so there should be no duplicates in it.

  14. #14
    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. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,903

    Re: Find(/lookup) next value

    Yes, that works now.

  15. #15
    Valued Forum Contributor
    Join Date
    05-11-2013
    Location
    Wales
    MS-Off Ver
    Excel 2010
    Posts
    586

    Re: Find(/lookup) next value

    Hi,

    Alternatively, you could do it with a Pivot Table.
    Please see attached.

    Regards

    peterrc
    Attached Files Attached Files

  16. #16
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: Find(/lookup) next value

    I seem to have an 'inverted' interpretation.

    In C5 this array entered
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Then in A5 array entered, filled across column B and down.
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Dave

  17. #17
    Registered User
    Join Date
    09-04-2014
    Location
    World
    MS-Off Ver
    2010
    Posts
    29

    Re: Find(/lookup) next value

    Thanks for contributing!

    Regarding pivot, I don't find it as dynamic and "user"-friendly as I want the outcome sheet to be..

    For the record, the workbook contains about 7000 rows, and therefore the least process consuming approach will be best. It may well be that the last post is a better fit...
    FlameRetired - could you please attach a workbook with your solution?

    Thanks in advance.

  18. #18
    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. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,903

    Re: Find(/lookup) next value

    You have marked the thread as solved, so it's unlikely that FlameRetired will see your request (unless he has subscribed to the thread).

    All you need to do is copy the formulae given into the cells stated in his post and confirm each with CTRL+SHIFT+ENTER.

  19. #19
    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. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,903

    Re: Find(/lookup) next value

    Here - I've done it for you.
    Attached Files Attached Files

  20. #20
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Find(/lookup) next value

    The least processor consuming is applying Excel's built-in options.
    Use a 'smart' table (not a pivot table).
    Attached Files Attached Files



  21. #21
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: Find(/lookup) next value

    Quote Originally Posted by henrikf1 View Post
    For the record, the workbook contains about 7000 rows, and therefore the least process consuming approach will be best. It may well be that the last post is a better fit...
    FlameRetired - could you please attach a workbook with your solution?

    Thanks in advance.
    henrikf1

    Sorry about the late reply. My ISP suddenly went down yesterday afternoon ... (upgrades).

    The file is attached.


    You hadn't mentioned anything about the 7000 lines before.

    You are correctly concerned about this. Array formulas are resource hungry. Let me know how this works and I will see what I can do at my end to make this less so.

    Any solution that I come up with will likely require helper columns to avoid the array formulas. Are you OK with that?

    P.S. Edit I just now looked at snb's solution. For what it's worth, IMHO that looks like the better solution by far. (Wish I'd had thought of it myself. LOL )
    Attached Files Attached Files
    Last edited by FlameRetired; 07-22-2016 at 11:06 AM.

  22. #22
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: Find(/lookup) next value

    Quote Originally Posted by AliGW View Post
    Here - I've done it for you.
    AliGW,

    Thanks for the backup. I hadn't noticed until I posted. Support is appreciated.

  23. #23
    Registered User
    Join Date
    09-04-2014
    Location
    World
    MS-Off Ver
    2010
    Posts
    29

    Re: Find(/lookup) next value

    Thanks for attaching a workbook with the formulas! I didn't get it to work in mine though...

    Helper columns will not be an issue, I think - so if you believe you can provide another suggestion that will be better regarding resources, it would be much appreciated.

    I'm working towards a set-up where the user chose from three lists with a lot of different choices, and therefore I can't see the solution with smart/pivot tables is as dynamic/user-friendly as I want it to be. Thanks a lot for the contribution though, I bet it's the least processor consuming and I will remember it for the future.

    Thanks in advance!

  24. #24
    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. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,903

    Re: Find(/lookup) next value

    Are you expecting further contributions to this thread? If so, then you really need to remove the SOLVED tag from the first post.

    Are you now saying that FlameRetired's proposed solution is not working for you? If so, then you need to make it clear in what way it isn't working. What is different in your real data sheet that is making it fail? Can you provide a sample sheet that is a better representation of the real data? We can't second guess potential hurdles if you are only giving us half the picture!

  25. #25
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: Find(/lookup) next value

    henrikf1,

    I too thought you were finished.

    This upload has a helper column in column G of Data. It returns Revenue unique to the 3 criteria.
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    I copied it down to row 7500 in an attempt to simulate what you expect to be the input and then some.

    While none of the following formulas require Ctrl + Shift + Enter they are still array formulas. With the sample data they perform well. Please let me know how they perform on live data.

    In C5 of Return this formula for the sorted unique Revenue.
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    I copied this and the next two formulas down to row 7000. Names returned by this formula in B5 and filled down.
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    In A5 to return the numbers.
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    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)

Similar Threads

  1. [SOLVED] Lookup formula to find lowest value with variable lookup criteria
    By brharrii in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 01-27-2015, 03:00 AM
  2. [SOLVED] Find with a lookup maybe?
    By gassiusmax in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 11-06-2014, 12:02 PM
  3. Excel 2007 : Help with Find or Lookup
    By StevenP138 in forum Excel General
    Replies: 2
    Last Post: 04-26-2012, 09:48 AM
  4. find or lookup
    By manickmj in forum Excel General
    Replies: 6
    Last Post: 11-04-2011, 02:45 AM
  5. Search lookup array to find lookup value contained within text string
    By Cookstein2 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 09-02-2011, 09:42 AM
  6. LOOKUP to find value that is not zero
    By cedarhill in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 03-17-2009, 01:27 PM
  7. Find Lookup help
    By RICOUK in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 01-21-2005, 03:49 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