Is it something with Excel or my math is bad?
Is it something with Excel or my math is bad?
Can you elaborate?
But if you are asking general question on why mod works on time. It's because Excel stores time as decimal (fraction), 1 hour being 1/24.
So MOD(Datetime, 1) strips date portion from datetime and leaves you with time only.
?Progress isn't made by early risers. It's made by lazy men trying to find easier ways to do something.?
― Robert A. Heinlein
You haven't given us anything to go off of here.
What does your data look like, what are you looking to do with it?
Consider uploading a small representative sample workbook along with the desired results (which you can enter manually) based on that sample data.
To upload an Excel workbook, follow these steps:
1) Click on "Go Advanced"
2) Click on "Manage Attachments"
3) Click on "Choose File"
4) Choose your file and click on "Open"
5) Click on "Upload"
6) Click on "Close this window"
=MOD((2:00 AM - 10:00 PM ),1).
How is "[mod of(why modulus)] 2:00 AM - 10:00PM /1" different from "2:00 AM - 10:00 PM".
It's because Time can't be displayed when it's in negative value.
So 2:00 - 22:00 won't work.
MOD function, interprets -0.83333 as 1 - 0.83333 (more accurately, see below).
Approx. 0.166667.
Which is 4/24 or 4 hours.
Note: Excel's Mod is expressed as
MOD(n,d)=n-d*INT(n/d)
You can test by using negative decimal.
=MOD(-0.4,1) returns 0.6
=MOD(-0.4,3) returns 2.6
EDIT:
Key here is INT(n/d)
INT always rounds down. So 1/2 = 0. But rounding down on negative -1/2 = -1 since 0 is "up" from -0.5
Therefore, INT(-0.83333/1), becomes -1.
Last edited by CK76; 07-26-2018 at 09:42 AM. Reason: See EDIT:
You may find below insightful.
http://mathforum.org/library/drmath/view/52343.html
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks