+ Reply to Thread
Results 1 to 6 of 6

VLOOKUP result rounding result in error

  1. #1
    Registered User
    Join Date
    03-16-2021
    Location
    Brentwood, CA
    MS-Off Ver
    10
    Posts
    3

    Question VLOOKUP result rounding result in error

    I have my VLOOKUP formula result formatted as general however it appears to be rounding the results.
    If my result is a whole number (ex: 89) it displays correctly, but if the number has a decimal, it rounds (ex: 89.2 displaying as 89). I only want the decimal places if there are any (the majority of my numbers do not have them). I tried the General 0.# formatting, but that puts a decimal after whole numbers as well as the non-whole numbers which I do not want.

  2. #2
    Forum Expert
    Join Date
    05-01-2014
    Location
    California, US
    MS-Off Ver
    Excel 2010
    Posts
    1,795

    Re: VLOOKUP result rounding result in error

    [.... deleted by me ....]

  3. #3
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,858

    Re: VLOOKUP result rounding result in error

    We will probably need a sample file in order to see what is happening. When I use a "General" format, functions/formulas will return the full value (including decimals) and will round as needed for the number to fit in the display. So, a result of 89.20000000000000000 will be displayed as 89.2, unless my column is quite narrow, in which case it will display as 89 or ## (indicating that Excel cannot fit the result inside of the narrow column). Using a "General" format, 89 would be displayed as 89.

    Using a format of 0.#, will do as you describe -- display 89.2 as 89.2 and 89.0 as 89. (with the decimal point)

    In all of these cases, even though Excel rounds the result (either to fit the available column width or as specified by the number format code), the cell retains the value to its full precision. 89.23456789 may display as 89.2, but the cell's value is still 89.23456789.

    The only exception I can think for this behavior is when someone (unwisely?) chooses the "precision as displayed" option in Excel's main option dialog.
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  4. #4
    Registered User
    Join Date
    03-16-2021
    Location
    Brentwood, CA
    MS-Off Ver
    10
    Posts
    3

    Re: VLOOKUP result rounding result in error

    I've attached my workbook to the thread so you can see the issue. I do not have my formula specifically set to round.
    Attached Files Attached Files

  5. #5
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,858

    Re: VLOOKUP result rounding result in error

    With the hidden ranges and the hidden sheet, it took me a bit to track down what your spreadsheet is doing, but it looks like it is doing exactly what it is programmed to do. Here's what I see happening:

    1) The value for "business licenses" starts out as 89.2 in sheet2 cell F79.
    2) There's a lookup function in Sheet2 column M (M5 for business licenses) that pulls values from column F of Sheet2 based on a text string. The lookup function is nested inside of a TEXT() function that converts the number to text in an integer format. So the number 89.2 in F79 becomes the text string "89" in M5. This is where the number gets rounded to the nearest integer as a result of the TEXT() function. Is the TEXT() function in error here?
    3) Column AH in deposit form simply copies the values from column M of sheet2. So AH5, like sheet2!M5 is simply "89" (as text not number).
    4) The final lookup function in B15 uses the text in the adjacent column and returns the appropriate value from AF:AH. In this case, the result is "89" (still text not number).

    The numbers are being rounded to the nearest integer in Sheet2 column M. If this is not what is intended, you will need to look at the TEXT(VLOOKUP(...),"0") formula and see what you intended that formula to do.

  6. #6
    Registered User
    Join Date
    03-16-2021
    Location
    Brentwood, CA
    MS-Off Ver
    10
    Posts
    3

    Re: VLOOKUP result rounding result in error

    Thank you. I will check what you referenced.

+ 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. Replies: 6
    Last Post: 03-20-2020, 09:26 AM
  2. [SOLVED] Help with Formula using variable as Date and result as integer, error in my result
    By Elomaldo in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-22-2014, 04:20 PM
  3. [SOLVED] Need help about rounding result from formula result.
    By calvinle in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-14-2014, 03:06 PM
  4. [SOLVED] VLOOKUP #N/A Error Result
    By bobboy in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-23-2013, 01:36 AM
  5. isblank & vlookup formula returns #n/a result and incorrect result
    By helpmeplease333 in forum Excel General
    Replies: 5
    Last Post: 05-06-2012, 11:41 PM
  6. Rounding error in Stdev function result.
    By David K in forum Excel Formulas & Functions
    Replies: 15
    Last Post: 01-12-2006, 12:25 AM
  7. vlookup based on random result returns incorrect result
    By rickat in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 12-05-2005, 09:20 AM

Tags for this Thread

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