+ Reply to Thread
Results 1 to 4 of 4

Find highest number

  1. #1
    Registered User
    Join Date
    11-14-2003
    Posts
    5

    Find highest number

    File attached.

    I'm trying to input the highest score in cell B16 for the relevant 'Course Played' (B15). The inputted scores for each Course Played are in the range B10:AE30. The data for each course is input down the column under each course name.
    Attached Files Attached Files

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

    Re: Find highest number

    Perhaps you want:

    =MIN(IF(($B$4:$AE$4=B$15)*ISNUMBER($B$10:$AE$10),$B$10:$AE$10))
    confirmed with CTRL + SHIFT + ENTER

    copied across to K16

    (edit: if you want the MAX rather than MIN change the above accordingly - I'm always confused by Stableford rules!)
    Last edited by DonkeyOte; 04-06-2010 at 12:32 PM.

  3. #3
    Registered User
    Join Date
    11-14-2003
    Posts
    5

    Re: Find highest number

    Great job! Please explain.

    I understand the MIN function finds the smallest number using 2 arguments, the IF statement matches the appropriate course to the range selected. I also understand the ISNUMBER function identifies if it's a number, but why is the 1st argument in the IF statement multiplied by the ISNUMBER? Confused!

    Many thanks for sorting.

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

    Re: Find highest number

    To explain requires outlining a few "general" principles

    Quote Originally Posted by jibberjabber
    In XL when looking at integers in Boolean terms only the value 0 is FALSE - any other numeric value is TRUE
    (eg =IF(0.2,TRUE,FALSE) -> TRUE, IF(0,TRUE,FALSE) -> FALSE)

    Working in reverse, in native XL Boolean TRUE / FALSE values when coerced to Integer equate to 1 / 0 respectively
    (in VBA True is -1 rather than 1)

    Booleans when multiplied are coerced
    With all the above points in mind it follows that we can conduct AND tests in Arrays by multiplying together Boolean results - eg:

    (test1)*(test2)

    If both tests return TRUE then the result of the multiplication will be 1
    (TRUE * TRUE -> 1 * 1 -> 1)

    If either / both tests return FALSE then the result of the multiplication will be 0
    (TRUE * FALSE -> 1 * 0 -> 0; FALSE * TRUE -> 0 * 1 -> 0; FALSE * FALSE -> 0 * 0 -> 0)

    The above coupled with the fact that in reverse we know only 0 equates to FALSE we can use the result of the Boolean coercion as the basis of our IF test, eg:

    =IF((test1)*(test2),"apple","banana")

    Only if test1 & test2 return TRUE will "apple" result - the other possibilities all result in the AND test generating 0 which is FALSE and thus "banana" will result, eg:

    =IF(0,"apple","banana") -> "banana"
    =IF(1,"apple","banana") -> "apple"

    does that make sense ?

    Assuming it does it follows that with regard to your function...

    The Array is populated with the values of B10:AE10 only where the corresponding value in row 4 matches B15 and where the value in the cell itself is numeric (ie test1*test2 -> 1)
    If either/both conditions fail to hold true the array is populated with a Boolean False by default (rather than the contents of the B10:AE10 cell).
    The MIN is applied to the resulting array of values and in this instance only numbers will be evaluated.

    Not perhaps the easiest thing to explain given the requisite explanation re: coercion etc...

+ 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