+ Reply to Thread
Results 1 to 7 of 7

Combining iferror, vlookup and min possible?

  1. #1
    Registered User
    Join Date
    07-20-2012
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    4

    Combining iferror, vlookup and min possible?

    I have been asked to find a minimum value out of a range of data linked to a name. However, some of the names I have been asked to find minimum values for are not in the database. Is it possible to combine an IFERROR into this formula =MIN(VLOOKUP(B2,".....","....",False))

    Sorry if its a simple question, am very new to excel!

  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: Combining iferror, vlookup and min possible?

    You can take any formula:

    =MyWorkingAndAlreadyTestedFormula


    ...and wrap it inside an IFERROR():

    =IFERROR(MyWorkingAndAlreadyTestedFormula, "")
    _________________
    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
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,640

    Re: Combining iferror, vlookup and min possible?

    VLOOKUP will only return the first value that matches the lookup value, B2. So you're not going to get a minimum regardless ... just an arbitrary value.

    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  4. #4
    Registered User
    Join Date
    07-17-2012
    Location
    Manama,Bahrain
    MS-Off Ver
    2003, 2007
    Posts
    71

    Re: Combining iferror, vlookup and min possible?

    You can use an array formula.

    =Min(if('LookupSheet'!$A$1:$A$10='ThisSheet'!A1,'LookupSheet'!$B$1:$B$10))

    substitute
    'LookupSheet'!$A$1:$A$10 with the Range in which the names are present (Should be a single column or row, with Absolute address)
    'ThisSheet'!A1 with the Cell in which the name that you are looking is present
    'LookupSheet'!$B$1:$B$10 with the Range in which you are looking for the minimum value. (Should be a single column or row, with Absolute address)

    both
    'LookupSheet'!$A$1:$A$10 and 'LookupSheet'!$B$1:$B$10 ranges should be of the same size.

    Last and most important step after you write the formula... While still inside the cell where the formula is present, Press CTRL+SHIFT+ENTER to turn the formula into an Array Formula.

    Drag the formula down to cover all names.


    Should Work.
    Last edited by ChuckYeager; 07-20-2012 at 07:58 PM. Reason: Formula Correction

  5. #5
    Registered User
    Join Date
    07-20-2012
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: Combining iferror, vlookup and min possible?

    Thank you all for the advice. ChuckYeager, that worked perfectly except some of the look up values should not be found in the data but the min value is coming back as 00:00:00 in time. Would there be a way to get rid of this at all? So that the formula acknowledge that the lookup value hasnt been found?
    Thanks!

  6. #6
    Registered User
    Join Date
    07-17-2012
    Location
    Manama,Bahrain
    MS-Off Ver
    2003, 2007
    Posts
    71

    Re: Combining iferror, vlookup and min possible?

    =IF(COUNTIF('LookupSheet'!$A$1:$A$10,'ThisSheet'!A1)<>0,Min(if('LookupSheet'!$A$1:$A$10='ThisSheet'!A1,'LookupSheet'!$B$1:$B$10)),"NA")

    What I have done is - added a COUNTIF() around the earlier formula which would check and if the lookup value is present in the reference table and return "NA", if the Lookup Value is not present else return MIN Value as per the earlier formula (in RED).

  7. #7
    Forum Guru
    Join Date
    05-24-2011
    Location
    India
    MS-Off Ver
    Office 2021
    Posts
    2,237

    Re: Combining iferror, vlookup and min possible?

    You could also use SMALL,

    =IFERROR(SMALL(if('LookupSheet'!$A$1:$A$10='ThisSheet'!A1,'LookupSheet'!$B$1:$B$10),1),"N/A")

    If lookup_value hasn't been found will return an error, so IFERROR will make it "N/A"
    Regards,
    Haseeb Avarakkan

    __________________________________
    "Feedback is the breakfast of champions"

+ 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