Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 09-27-2023, 07:38 AM
otuatail otuatail is offline Rounding up in excel Windows 7 64bit Rounding up in excel Office 2016
Competent Performer
Rounding up in excel
 
Join Date: Jun 2012
Posts: 245
otuatail is on a distinguished road
Default


Yes it does change every second but under windows 10, i can't change the clock hours and minutes temperory. I could do in windows 7.

Okay =ROUND(D3-NOW(),0) does seem to work. I will need to wait until tomorrow morning to see as I can't change the hour on my PC.
Reply With Quote
  #2  
Old 09-27-2023, 03:38 PM
joeu2004 joeu2004 is offline Rounding up in excel Windows 7 64bit Rounding up in excel Office 2010
Advanced Beginner
 
Join Date: Aug 2016
Posts: 32
joeu2004 is on a distinguished road
Default

Quote:
Originally Posted by otuatail View Post
Yes it does change every second
No, it does not.

NOW() changes whenever Excel recalculates anywhere in the workbook (and the calculation mode is Automatic).

To demonstrate, in a new workbook, format A1 and B1 as Custom m/d/yyyy h:mm:ss.000. Widen columns A:B sufficiently; 3 default column widths should suffice.

(You might choose a different date format.)

Enter =NOW() into A1. Then quickly copy A1 and paste-special-value into B1.

Pasting will probably cause A1 to change. But the difference should be small. For example, I see 9/27/2023 13:40:31.660 in A1 and 9/27/2023 13:40:27.070 in B1, a difference of less than 4 sec.

Now, leave the workbook alone for however long you wish to demonstrate that A1 is not updating automatically.

Finally, cause a recalculation. For example, enter anything new into any other cell.

Now, A1 will be very different from B1. For example, after I typed these instructions, when I enter something into C1, A1 becomes 9/27/2023 13:45:09.000, about 5 min later than B1. QED.

-----
Quote:
Originally Posted by otuatail View Post
Okay =ROUND(D3-NOW(),0) does seem to work. I will need to wait until tomorrow morning to see as I can't change the hour on my PC.
Not really.

ROUND(D3-NOW(),0) rounds the difference to a number of days, assuming that D3 contains an Excel date or date/time value ("serial number") and E3 is formatted as Number (or General?).

A decimal difference of 0.5 is 12 hours. So ostensibly, you just need to enter a difference of 12 hours plus or minus 0 or 1/1000 second into D3 to test the rounding formula.

(1/1000 second because Excel formats time only to the millisecond. But actually, any decimal fraction of a second should suffice.)

So, we might enter =NOW() into A3 and the following formulas, formatting A3:E3 as Custom m/d/yyyy h:mm:ss.000 with sufficiently widened cells.

B3: =A3 - 0.5 - "0:00:0.001"
C3: =A3 - 0.5
D3: =A3 + 0.5
E3: =A3 + 0.5 + "0:00:0.001"
B4:E4: =ROUND(B3-$A$3, 0) formatted as Number with 14 decimal places
A5:E5: =A3 formatted as Number with 10 decimal places
B6:E6: =B3-$A$3 formatted as Number with 15 decimal places

For example, I see.... (click here).



Note that ROUND rounds away from zero (when it rounds up). So -0.5 rounds to -1.

If that is not what you expect, explain your intent and expectations in more detail, along with numerical examples.


PS.... And there is nothing sacrosanct about NOW(). You might enter specific date/time values into A3. For example, you might enter even and odd date "serial numbers" (the integer part) with times 0:00 and 12:00 to convince yourself that Excel does not do "banker's rounding" to even, as VBA does.


And if you want to emulate NOW(), enter times in the form h:mm:ss.ff0, where "ff0" is some number of 1/100 seconds; for example, 1:23:45.670. 1/100 because NOW() rounds down current time to the 1/100 second. Note that unfortunately, we cannot see or edit the fractional seconds in the Formula Bar; and the time displayed in the Formula Bar is rounded to the second.

Last edited by joeu2004; 09-28-2023 at 07:39 AM. Reason: remove extra blank lines; PS
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Rounding up in excel Rounding of dollar value Formd Mail Merge 2 07-06-2022 01:21 PM
Custom rounding up paulkaye Excel 8 09-03-2016 11:12 PM
Rounding up in excel Excel Seems to be Rounding Twice Rather Than Once melissapete24 Excel 5 08-27-2016 12:51 AM
Rounding to nearest 0.25 Guloluseus Excel 5 10-27-2015 11:28 PM
Rounding up in excel Standard Dev. Rounding - Excel judicial85 Excel 1 08-28-2011 05:41 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 10:06 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft