+ Reply to Thread
Results 1 to 6 of 6

If Error formula

  1. #1
    Registered User
    Join Date
    10-10-2014
    Location
    seattle wa
    MS-Off Ver
    2007
    Posts
    63

    If Error formula

    Hi,

    Can any one please explain me the following formula. I do understand the vlookup part. It's looking up data in my other sheet but the iferror and left, right, i have no idea what that is saying.

    =IFERROR(VLOOKUP($B130,Quarterly!$A$75:$Z$145,(LEFT(AT$129,4)-2008)*4-(7-RIGHT(AT$129)),FALSE),0)

    Thank you

  2. #2
    Valued Forum Contributor nigelbloomy's Avatar
    Join Date
    11-06-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    1,011

    Re: If Error formula

    The iferror just says that if the whole formula in the middle gives you an error, then show a 0.

    The vlookup is looking up the value in B130 and searching for it in column A of the Quarterly sheet. Once it finds it, the vlookup needs to know which column to look at so it can bring back that matching value.

    Left looks at the left 4 digits of AT129. Multiplying it by 4, then minus 7 less than the rightmost value in AT129. It uses that formula to figure out which column to look at.

    That's a pretty confusing way to figure out whihc column to get, but that's what it is doing.
    Some people volunteer in soup kitchens or hospitals. I choose to make the world better by trying to help you with Excel. We're all learning.

    <---Click * Add Reputation for all helpful comments. It's like giving a smile.
    Forum Rules: How to mark your post [Solved] and have a happier, Excel enriched life.

  3. #3
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: If Error formula

    =IFERROR(VLOOKUP($B130,Quarterly!$A$75:$Z$145,(LEFT(AT$129,4)-2008)*4-(7-RIGHT(AT$129)),FALSE),0)

    says that first it evaluates this part

    VLOOKUP($B130,Quarterly!$A$75:$Z$145,(LEFT(AT$129,4)-2008)*4-(7-RIGHT(AT$129)),FALSE)

    and if there is no error, IFERROR returns the value that is returned by VLOOKUP. If that VLOOKUP returns an error, then IFERROR will return the 0 (in red above)

    LEFT(AT$129,4)

    returns the 4 leftmost characters of the string in AT$129

    RIGHT(AT$129)

    returns the 1 rightmost character in the string AT$129 (if the second argument is missing, it is assumed to be 1)
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  4. #4
    Valued Forum Contributor
    Join Date
    04-22-2014
    Location
    Auckland, New Zealand
    MS-Off Ver
    Office 365 (work) and Excel 2013 (home)
    Posts
    1,167

    Re: If Error formula

    LEFT(AT$129,4) finds the first 4 characters from the left of whatever is in cell AT129. Given that it then deducts off 2008, my guess is that AT129 holds a date, and it's calculating the number of years between the year of the date in that cell and 2008.

    RIGHT(AT$129) finds the right most character of whatever is in cell AT129.

    IFERROR is matched with the ,0) at the end of the formula, and it returns a 0 if the rest of the formula would return an error.
    Please add reputation by clicking on the * if I have helped.
    Please mark the thread SOLVED if your issue has been resolved.
    Thanks, Glenn.

  5. #5
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: If Error formula

    The IFERROR is easy.
    If the result of the Vlookup is an error (like #N/A), then it returns 0
    =IFERROR(VLOOKUP($B130,Quarterly!$A$75:$Z$145,(LEFT(AT$129,4)-2008)*4-(7-RIGHT(AT$129)),FALSE),0)

    Then the basic vlookup is
    =VLOOKUP($B130,Quarterly!$A$75:$Z$145,(LEFT(AT$129,4)-2008)*4-(7-RIGHT(AT$129)),FALSE)

    The left and right bits seem to be being used to determine the Column Index # of the vlookup (the 3rd part of a vlookup)
    What's in AT129 ?

    LEFT(AT$129,4)
    returns the 4 leftmost characters of the string in AT$129

    RIGHT(AT$129)
    returns the 1 rightmost character in the string AT$129 (if the second argument is missing, it is assumed to be 1)

    Let's say AT129 is 20155

    Then you have
    (LEFT(AT$129,4)-2008)*4-(7-RIGHT(AT$129))
    (2015-2008)*4-(7-5)
    (7)*4-(2)
    28-(2)
    26

    So the 3rd argument of the vlookup becomes 26
    Last edited by Jonmo1; 06-22-2015 at 04:42 PM.

  6. #6
    Registered User
    Join Date
    10-10-2014
    Location
    seattle wa
    MS-Off Ver
    2007
    Posts
    63

    Re: If Error formula

    thank you all.

    Step by step process makes it so much easy

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Inputbox error message. Formula you typed contains an error.
    By maacmaac in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 07-09-2013, 02:25 PM
  2. Formula Error-Error Message
    By Paige in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-25-2006, 04:15 PM
  3. Replies: 4
    Last Post: 03-24-2006, 07:20 AM
  4. Error values:DIV/0! error in SumProduct formula with no division
    By Jerry W. Lewis in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 09-06-2005, 07:05 PM
  5. Formula error with Mac resulting in '#NAME' error
    By Linking to specific cells in pivot table in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-01-2005, 03:05 AM

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