Results 1 to 4 of 4

Cells look the same and equal but are not!

Threaded View

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

    Re: Cells look the same and equal but are not!

    Quote Originally Posted by drgkt View Post
    Why B4 is not equal to C4?
    First, you should format them as Custom [h]:mm:ss, since you are computing a sum of time. Then you would see that the number of hours is 51, not 3.

    Second, for debugging purposes, if you temporarily format them as Number with 14 decimal places, you would see the difference: 2.13710648148149 in B4 v. 2.13710648148148 in C4. And that is only approximate; the actual difference (B4-C4) is about 8.88E-15.

    It is very common to encounter such infinitesimal differences. The problem arises because Excel time is stored as a fraction of a day, which is a non-integer. And most non-integers cannot be represented exactly in 64-bit binary floating-point, which Excel uses internally to represent numbers.

    To remedy this, change the formulas as follows:

    B4: =--TEXT(SUM(B6:B438),"[h]:mm:ss")
    C4: =--TEXT(SUM(C6:C438),"[h]:mm:ss")

    The TEXT function ensures that time is rounded to the same internal binary representation as the time constant that you might write. The double negate ("--") converts text to number.
    Last edited by joeu2004; 12-19-2015 at 12:08 AM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 3
    Last Post: 09-26-2014, 12:12 PM
  2. Multiple Cells values - formula to see which cells added together equal zero?
    By rodders0223 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 11-15-2013, 11:09 AM
  3. Replies: 2
    Last Post: 09-06-2013, 02:25 PM
  4. Replies: 2
    Last Post: 08-06-2013, 03:27 PM
  5. Compare two cells, if equal move a third cells data to another cell
    By eriick in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 06-24-2013, 05:38 PM
  6. [SOLVED] Counting cells in a column to add formulas to that equal number of cells
    By flipjarg in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-11-2012, 11:45 AM
  7. Creating a loop to make cells equal other cells
    By Tuneman in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-17-2010, 07:40 PM

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