+ Reply to Thread
Results 1 to 7 of 7

Excel 2007 : Problem using MAX and INDEX in one formula

Hybrid View

  1. #1
    Registered User
    Join Date
    07-18-2011
    Location
    Bahrain
    MS-Off Ver
    Excel 2007
    Posts
    7

    Problem using MAX and INDEX in one formula

    Dears,

    I want to return the maximum value in a column if it matches two categories (Carrier and Type).

    So far, I did successfully to use array formula (& CSE) to get the corresponding value; however, i don’t know where to fit the MAX function.

    Attached is a sample of what I want to do

    I would appreciate if anyone can please take a look and help me

    Thank you in advance
    Attached Files Attached Files
    Last edited by mamady; 09-23-2011 at 11:42 AM.

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

    Re: Problem using MAX and INDEX in one formula

    1) Change F1 to read "Premium", take out the other words
    2) Change G1 to read LCR
    3) Put this array formula in F2: =MAX($B$2:$B$13*(($A$2:$A$13=$E2)*($C$2:$C$13=F$1)))
    ...confirmed with Ctrl-Shift-Enter to activate the array
    4) Copy that cell down and across the table
    _________________
    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!)

  3. #3
    Registered User
    Join Date
    07-18-2011
    Location
    Bahrain
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: Problem using MAX and INDEX in one formula

    Quote Originally Posted by JBeaucaire View Post
    1) Change F1 to read "Premium", take out the other words
    2) Change G1 to read LCR
    3) Put this array formula in F2: =MAX($B$2:$B$13*(($A$2:$A$13=$E2)*($C$2:$C$13=F$1)))
    ...confirmed with Ctrl-Shift-Enter to activate the array
    4) Copy that cell down and across the table
    Thank ypu very much dear,
    it works

    I appreicate it

  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: Problem using MAX and INDEX in one formula

    Thanks. BTW, there's no need to quote my posts into yours unless we're discussing something specific further from my post. Just use the QUICK REPLY button instead of the QUOTE button. Or just use the Message box below.

    If that takes care of your need, please click EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED.

  5. #5
    Registered User
    Join Date
    07-18-2011
    Location
    Bahrain
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: Problem using MAX and INDEX in one formula

    Done

    I have a quick question, if I may

    What does " * " do in your formula?, as I am tryining to understand the logic used.

    Thanks again

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

    Re: Problem using MAX and INDEX in one formula

    The asterisk is the multiplication operator. If you really want to see how that formula works, click the cell, then use the Evaluate Formula icon on the Formula Auditing toolbar. Step through the formula one calc at a time.

    The formula creates two arrays. The first array is all the values in in B2:B13. The second array is a series of TRUE/FALSE answers to the "tests" we did on the values in A2:A13 and C2:C13, which are multiplied together to create an array of 0s/1s.

    Then the first array is multiplied into the second array, all the values multiplied by 0 disappear from the final resulting array, the ones multiplied by 1 remain, then that array is used for the final MAX() test.

  7. #7
    Registered User
    Join Date
    07-18-2011
    Location
    Bahrain
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: Problem using MAX and INDEX in one formula

    Great

    I got it, as you suggested; I just followed the steps with (Evaluate Formula) feature. You are genius.

    Thanks again dear

+ 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