+ Reply to Thread
Results 1 to 10 of 10

use min function with a criteia

  1. #1
    Registered User
    Join Date
    06-25-2009
    Location
    Oregon,USA
    MS-Off Ver
    Excel 2003
    Posts
    6

    use min function with a criteia

    Hi, I am trying to use the min function using a criteria. I have two columns, one with names and the other with numbers. I want to find the minimum number in column A that relates to a name in column B.

    Thanks,
    Rich

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

    Re: use min function with a criteia

    If the data is not sorted then

    =MIN(IF(A1:A100="name",B1:B100))
    committed with CTRL + SHIFT + ENTER

  3. #3
    Registered User
    Join Date
    06-25-2009
    Location
    Oregon,USA
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: use min function with a criteia

    Thanks, that is what i was looking for, if you got this twice, sorry, i am new to this site

  4. #4
    Registered User
    Join Date
    06-25-2009
    Location
    Oregon,USA
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: use min function with a criteia

    Ok, the column is sorted and i am getting back the minimum of the whole column and not the minimum associated with the name, is it because the column is sorted?

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

    Re: use min function with a criteia

    Was the formulae forced into an Array with CTRL + SHIFT + ENTER (if it was it will appear as {=MIN(...)}, if not, reset the Array.

    With the data sorted you may be able to avoid an Array, how is the data sorted - by value or by name - and in which order (asc/desc) ?

  6. #6
    Registered User
    Join Date
    06-25-2009
    Location
    Oregon,USA
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: use min function with a criteia

    It is sorted by name assending, so when you say force the array you mean to hit CTLR + SHIFT + ENTER instead of just ENTER, right?

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

    Re: use min function with a criteia

    Yes... CTRL + SHIFT + ENTER

    However, if your data is as you say now sorted you can use a non-array approach thanks to the fact that you can use MATCH (with INDEX) to establish the appropriate range to look in (as the data is now effectively grouped together), ie:

    =MIN(INDEX(B1:B100,MATCH("name",A1:A100,0)):INDEX(B1:B100,MATCH("name",A1:A100)))

    ("name" can obviously be a cell containing the name of interest)

  8. #8
    Registered User
    Join Date
    06-25-2009
    Location
    Oregon,USA
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: use min function with a criteia

    Excellent, that worked on the first name i tried. I had thought it would be an easier formula. I am pretty good with Excel, but i haven't seen a formula like this one, I am curious why the ",0" in the first expresion that "name" was used?

    This is a very helpful site by the way!!!

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

    Re: use min function with a criteia

    Might sound obvious but first point of reference: XL Help... it's useful in understanding the various arguments/parameters used within a Function

    In the case of MATCH the final parameter (match_type) is optional (denoted by [ ]) - when omitted it is default of 1, when set to 0 it conducts an exact match based on criteria value so it follows that with data sorted in ASC order:

    MATCH(criteria,range,0)

    returns first index position of criteria within the range whereas

    MATCH(criteria,range)

    returns the last instance (parameter omitted means default match_type setting of 1)

    I can then use the above with INDEX in reference form to create a range:

    INDEX(A:A,MATCH(criteria,range,0)):INDEX(A:A,MATCH(criteria,range))

    will say generate a range of A1:A5 (1 & 5 being determined by the respective MATCH functions)

    Against which I can apply my *other* function - in this case MIN

    =MIN(INDEX(...):INDEX(...))

  10. #10
    Registered User
    Join Date
    06-25-2009
    Location
    Oregon,USA
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: use min function with a criteia

    Alrighty, thanks again, I also work with Access quite a bit, I bet you folks have a form for that also? I am sorry to say I went to school for this, but it has been a few years and I have forgotten much. In this new job I have, I will be designing and managing both data bases and spread sheets. I think with time I will start to remember. . . I Hope

    Thanks for your help!!

+ 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