+ Reply to Thread
Results 1 to 10 of 10

Formula calculation is incorrect.

  1. #1
    Registered User
    Join Date
    09-03-2008
    Location
    California
    Posts
    35

    Formula calculation is incorrect.

    Hello everyone,

    Working with Excel 2007 and Vista machine.
    I have two sheets:
    Sheet1: Sheet where I take lenght, width and height measurements.
    Sheet2. Measurements from Sheet 1 are imported into sheet2 and once the respective columns are populated the volume is calculated.

    The problem is for some reason the formula I have for calculating Volume just doesnt work.

    For example the measurements are:
    Lenght = 6.9 (Column D); Widht = 8.49 (Column E); Height = Blank and hidden (Column F);
    Volume is calculated as:
    Volume =IF(ISBLANK($D3),"",IF(ISBLANK($F3),IF($D3>$E3,$D3*($E3^2)*0.5,$E3*($D3^2)*0.5),$D3*$E3*$F3))

    For some reason it always follows that value in column D is greater than value in column E and makes the calculation.

    In this case the Volume should be 202 but it calculates the value to be 248.

    I dont know whats wrong.
    Can anyone help?

    Thanks,
    Last edited by arthurbr; 08-14-2010 at 06:20 AM.

  2. #2
    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: Issues with Formula

    Based on your description, you are getting the wrong answer, so the problem must be in your workbook. Can you post your file?

    BTW what kind of shapes are you calcluating volume for? I can't figure out how your formula works, or how you can leave one dimension blank.
    Last edited by 6StringJazzer; 08-13-2010 at 01:33 PM. Reason: grammar
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Issues with Formula

    I get 202.104.

    ARe you sure you have autocalculations on?

    In the Formuals tab, go to Calculation Options and ensure you have Automatic on.

    Or one/both your values are formatted as text.

    Type a 0 in any free cell and copy it, then select D3 and E3 and then right-click Paste Special and select Add.
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  4. #4
    Registered User
    Join Date
    09-03-2008
    Location
    California
    Posts
    35

    Formula calculation is incorrect.

    I have auto calculations on.

    Both my values are numbers and not Text.

    I am not sure whats happening.

    Any help is appreciated.
    Last edited by supernova5271; 08-13-2010 at 03:46 PM. Reason: Insufficient information in the title

  5. #5
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Formula calculation is incorrect.

    Post a workbook.
    Entia non sunt multiplicanda sine necessitate

  6. #6
    Registered User
    Join Date
    09-03-2008
    Location
    California
    Posts
    35

    Re: Formula calculation is incorrect.

    Attaching two sheets.

    Open sheet2 and use the GetData Macro to Import the Sheet1.

    You will see the Volume measurement is in correctly calculated in Sheet2 and differs from the one in sheet1 even though the calculations are same.

    Thanks for the help,
    Attached Files Attached Files

  7. #7
    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: Formula calculation is incorrect.

    I got a "subscript out of range" error running the macro, but could not diagnose it because the VBA is password-protected. The data loaded anyway. I can't rule out that the macro is part of the problem.

    When I insert the formula

    =D2>E2

    I get a result of TRUE even though the result should be FALSE. This is causing your problem although the root cause it not evident (to me). I also tried

    =E2-D2

    and got the correct result of 1.59.

    If I type by hand the same two values at some random place in the same workbook, I get the same odd result, but this doesn't happen if I do that in a new workbook. I also get the incorrect result if I copy the same data to a new workbook.

    So I've done some poking around but I'm sorry that I still can't tell what you have to fix.

  8. #8
    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: Formula calculation is incorrect.

    The value 6.9 is being pasted in as text. That's your problem.

    ETA: I haven't seen anything quite like it before; there is no single-quote mark in the formula box to indicate that it's text, but when you modify the format to show additional decimal places, there is no change. And if I type "6.9" into the same cell everything works fine. So I'm pretty sure that is what is going on.
    Last edited by 6StringJazzer; 08-16-2010 at 03:16 PM.

  9. #9
    Registered User
    Join Date
    09-03-2008
    Location
    California
    Posts
    35

    Re: Formula calculation is incorrect.

    Thank you very much.

    Thats very very useful.

    Is there a way to force the cells to have only numbers and not text when I am importing the values from another sheet.

  10. #10
    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: Formula calculation is incorrect.

    Quote Originally Posted by supernova5271 View Post
    Is there a way to force the cells to have only numbers and not text when I am importing the values from another sheet.
    Best direction at this point is for you to provide your VBA that is associated with the button.

+ 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