+ Reply to Thread
Results 1 to 9 of 9

lookup max value in length (column c)& return value in column a

  1. #1
    Registered User
    Join Date
    07-03-2013
    Location
    United Kingdom
    MS-Off Ver
    Excel 2007
    Posts
    6

    lookup max value in length (column c)& return value in column a

    table:
    Please Login or Register  to view this content.
    need the activity number (column a), of the largest length(column c), if column b is between 90 to 180 & column d ="insertion".
    thank you
    Last edited by JBeaucaire; 11-10-2013 at 03:46 AM.

  2. #2
    Forum Guru benishiryo's Avatar
    Join Date
    03-25-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2013
    Posts
    5,147

    Re: lookup max value in length (column c)& return value in column a

    hi zappyzoo, maybe this array formula:
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    ...confirmed by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER. You will know the array is active when you see curly braces { } appear around your formula. If you do not CTRL+SHIFT+ENTER you will get an error or a clearly incorrect answer. Press F2 on that cell and try again.

    Thanks, if you have clicked on the * and added our rep.

    If you're satisfied with the answer, click Thread Tools above your first post, select "Mark your thread as Solved".

    "Contentment is not the fulfillment of what you want, but the realization of what you already have."


    Tips & Tutorials I Compiled | How to Get Quick & Good Answers

  3. #3
    Valued Forum Contributor Neil_'s Avatar
    Join Date
    04-19-2013
    Location
    Yorkshire
    MS-Off Ver
    Office 365 Enterprise E3 2013 / 2016
    Posts
    479

    Re: lookup max value in length (column c)& return value in column a

    Probably an easier way than this, but enter as an array formula (Ctrl+shift+enter)
    =SUM((D2:D7="Insertion")*(B2:B7>=90)*(B2:B7<=180)*(C2:C7=(MAX((D2:D7="Insertion")*(B2:B7>=90)*(B2:B7<=180)*(C2:C7))))*(A2:A7))
    Frob first, tweak later

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: lookup max value in length (column c)& return value in column a

    Ha, my version of the same idea:

    =INDEX($A$2:$A$7, MATCH(MAX(($B$2:$B$7>=90)*($B$2:$B$7<=180)*($D$2:$D$7="insertion")*($C$2:$C$7)),
    INDEX(($B$2:$B$7>=90)*($B$2:$B$7<=180)*($D$2:$D$7="insertion")*($C$2:$C$7), 0), 0))


    ...confirmed by pressing CTRL+SHIFT+ENTER to activate the array, not just ENTER. You will know the array is active when you see curly braces { } appear around your formula. If you do not CTRL+SHIFT+ENTER you will get an error or a clearly incorrect answer. Press F2 on that cell and try again.

    http://screencast.com/t/ybYNcSAa
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  5. #5
    Registered User
    Join Date
    12-15-2012
    Location
    In a bin
    MS-Off Ver
    Excel 2013
    Posts
    43

    Re: lookup max value in length (column c)& return value in column a

    The LOOKUP could be an option! Assuming your data is in A1:E7 including headers.

    Formula: copy to clipboard
    Please Login or Register  to view this content.

    Or
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Last edited by Crisp Packet; 11-10-2013 at 04:29 AM. Reason: Forgot the column D in the LOOKUP.

  6. #6
    Valued Forum Contributor Neil_'s Avatar
    Join Date
    04-19-2013
    Location
    Yorkshire
    MS-Off Ver
    Office 365 Enterprise E3 2013 / 2016
    Posts
    479

    Re: lookup max value in length (column c)& return value in column a

    So many ways to crack an egg. If you change C3 to the highest value, all the solutions still work except the lookup

    Edit:
    If you then change D3 to 'Test', the Sumproduct formula fails
    Last edited by Neil_; 11-10-2013 at 04:18 AM.

  7. #7
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: lookup max value in length (column c)& return value in column a

    THe INDEX array I suggested is the only one I would trust. It will give a correct answer (the first one) from the matching criteria even if there are multiple lengths that match the max length.

  8. #8
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,649

    Re: lookup max value in length (column c)& return value in column a

    Quote Originally Posted by JBeaucaire View Post
    THe INDEX array I suggested is the only one I would trust. It will give a correct answer (the first one) from the matching criteria even if there are multiple lengths that match the max length.
    If you change all the sizes to less than 90 in col. B for all the insertion method in col. D, it still gives the result 1, while it should not return any value from col. A.
    Right?
    Regards
    sktneer


    Treat people the way you want to be treated. Talk to people the way you want to be talked to.
    Respect is earned NOT given.

  9. #9
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,649

    Re: lookup max value in length (column c)& return value in column a

    I think only benishiryo's code works well with all the criteria if it is included with IFERROR cluase in it.

    Please Login or Register  to view this content.

+ 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: 03-13-2013, 12:38 PM
  2. Lookup value in one column, match and return result from another column
    By raehippychick in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 10-13-2012, 03:26 AM
  3. [SOLVED] Lookup and Match Column A with Column B and return Value from Column C
    By Mikeytres in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 08-28-2012, 12:19 PM
  4. Replies: 1
    Last Post: 01-05-2011, 05:18 PM
  5. VLOOKUP: Return value from column left of lookup column?
    By XiaoWei in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-27-2008, 06:17 AM

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