+ Reply to Thread
Results 1 to 16 of 16

Maximum Smaller

  1. #1
    Registered User
    Join Date
    04-29-2009
    Location
    Italy
    MS-Off Ver
    Excel 2007
    Posts
    9

    Maximum Smaller

    Hi there, i'm new, sorry for my bad English...
    My problem is this:
    I would like to write a formula to have a result in a cell that gives me the maximum value of a column, but smaller than another cell.

    For example:
    C1 = Maximum value in column A1:A20, but smaller than B1.

    Thank you in advance for the help, i hope you understand my question.

  2. #2
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,607

    Re: Maximum Smaller

    This?

    =MIN(MAX(A1:A20);B1)

  3. #3
    Registered User
    Join Date
    04-29-2009
    Location
    Italy
    MS-Off Ver
    Excel 2007
    Posts
    9

    Re: Maximum Smaller

    no... it gives me the value in B1...

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

    Re: Maximum Smaller

    I think you're saying you want something like

    C1: =MAX(IF(A1:A20<B1,A1:A20))
    committed with CTRL + SHIFT + ENTER

    Alternatively

    C1: =SMALL(A1:A20,COUNTIF(A1:A20,"<"&B1))

    (alter comma delimiter according to regional settings if/as required)
    Last edited by DonkeyOte; 04-29-2009 at 08:43 AM. Reason: MAX & SMALL not MIN & LARGE -- doh

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

    Re: Maximum Smaller

    =MAX((A1:A20<B1)*(A1:A20))
    confirmed with CSE
    "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

  6. #6
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,607

    Re: Maximum Smaller

    yes.. Only MAX instead of MIN in first case

  7. #7
    Registered User
    Join Date
    04-29-2009
    Location
    Italy
    MS-Off Ver
    Excel 2007
    Posts
    9

    Re: Maximum Smaller

    Quote Originally Posted by DonkeyOte View Post
    I think you're saying you want something like

    C1: =MAX(IF(A1:A20<B1,A1:A20))
    committed with CTRL + SHIFT + ENTER

    Alternatively

    C1: =SMALL(A1:A20,COUNTIF(A1:A20,"<"&B1))

    (alter comma delimiter according to regional settings if/as required)
    Sorry, they don't work, but we're near it.
    your second formula gave me the minumum bigger than b1. In other words, the opposite.

  8. #8
    Registered User
    Join Date
    04-29-2009
    Location
    Italy
    MS-Off Ver
    Excel 2007
    Posts
    9

    Re: Maximum Smaller

    =BIG(A1:A20;COUNTIF(A1:A20;">"&B1)+1)
    This is the right one.
    Thank you very much!!!
    Last edited by silvernight84; 04-29-2009 at 08:59 AM.

  9. #9
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,607

    Re: Maximum Smaller

    Did you commited with ctrl+shift+enter?

    you need to see brackets {=MAX(IF(A1:A20<B1;A1:A20))} around formula

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

    Re: Maximum Smaller

    you dont need the IF part for max only for min
    BIG ?

  11. #11
    Forum Contributor
    Join Date
    01-13-2009
    Location
    Mumbai
    MS-Off Ver
    Excel 2003, 2007
    Posts
    168

    Re: Maximum Smaller

    Hi silvernight,

    If suppose following is your data

    A1 - 1
    A2 - 2
    A3 - 4
    A4 - 5
    A5 - 5.5
    A6 - 7
    A7 - 8
    A8 - 8
    A9 - 10
    A10 - 11

    And B1 - 6

    Then what value do you want C1 should take.

    Should it be 5.5 or something else.

  12. #12
    Registered User
    Join Date
    04-29-2009
    Location
    Italy
    MS-Off Ver
    Excel 2007
    Posts
    9

    Re: Maximum Smaller

    With brachets it says error... Don't know why...

  13. #13
    Registered User
    Join Date
    04-29-2009
    Location
    Italy
    MS-Off Ver
    Excel 2007
    Posts
    9

    Re: Maximum Smaller

    Quote Originally Posted by c.vaibhav View Post
    Hi silvernight,

    If suppose following is your data

    A1 - 1
    A2 - 2
    A3 - 4
    A4 - 5
    A5 - 5.5
    A6 - 7
    A7 - 8
    A8 - 8
    A9 - 10
    A10 - 11

    And B1 - 6

    Then what value do you want C1 should take.

    Should it be 5.5 or something else.
    right, 5.5

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

    Re: Maximum Smaller

    Again...

    C1: =SMALL(A1:A20,COUNTIF(A1:A20,"<"&B1))

    You would get an error if there were no values in A1:A20 less than B1 so you could encase within an IF

    C1: =IF(MIN(A1:A20)>=B1,"",SMALL(A1:A20,COUNTIF(A1:A20,"<"&B1)))

  15. #15
    Registered User
    Join Date
    04-29-2009
    Location
    Italy
    MS-Off Ver
    Excel 2007
    Posts
    9

    Smile Re: Maximum Smaller

    Quote Originally Posted by DonkeyOte View Post
    Again...

    C1: =SMALL(A1:A20,COUNTIF(A1:A20,"<"&B1))

    You would get an error if there were no values in A1:A20 less than B1 so you could encase within an IF

    C1: =IF(MIN(A1:A20)>=B1,"",SMALL(A1:A20,COUNTIF(A1:A20,"<"&B1)))
    Right, these 2 work perfectly, thanks!!!

  16. #16
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,607

    Re: Maximum Smaller

    Make this thread [solved]. thx

+ 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