#Value! result for date subtraction formula

happen

New Member
Joined
Sep 11, 2023
Messages
5
Office Version
  1. 365
Platform
  1. Windows
Hello,
I am trying to subtract two dates using DatedIf, ie., DatedIf(C5-C6,"D", but the two dates I am subtracting are the same dates (08/03/2023 - 08/03/2023) and should equal zero but I am getting a #Value! error. I've tried changing the date formatting to several different formats and even tried general, text and custom and still get the error. I am using O365 Excel. Thank you!
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
Welcome to the Board!

You either subtract the two dates, or use DATEDIF, but not both together, i.e.
use:
Excel Formula:
=C5-C6
or
Excel Formula:
=DATEDIF(C5,C6,"D")

Note that simple subtraction will work here because Excel stores dates as the number of DAYS since 1/0/1900.
So if you subtract any two dates, the number returned will always represent number of DAYS, by default.
 
Upvote 0
You shouldn't be subtracting them, use
Excel Formula:
=DATEDIF(C5,C6,"d")
or simply
Excel Formula:
=c5-c6
 
Upvote 0
Welcome to the Board!

You either subtract the two dates, or use DATEDIF, but not both together, i.e.
use:
Excel Formula:
=C5-C6
or
Excel Formula:
=DATEDIF(C5,C6,"D")

Note that simple subtraction will work here because Excel stores dates as the number of DAYS since 1/0/1900.
So if you subtract any two dates, the number returned will always represent number of DAYS, by default.
Correct, I tried using either one and no matter what I am getting the #Value!. I was hoping to find out why I am not getting a 0 as a result.
 
Upvote 0
You shouldn't be subtracting them, use
Excel Formula:
=DATEDIF(C5,C6,"d")
or simply
Excel Formula:
=c5-c6
Correct, I tried using either one and no matter what I am getting the #Value!. I was hoping to find out why I am not getting a 0 as a result.
 
Upvote 0
That sounds as if your £dates" are really text & not proper dates.
If you use
Excel Formula:
=isnumber(c5)
and the same for c6 what do they both return?
 
Upvote 0
That sounds as if your £dates" are really text & not proper dates.
If you use
Excel Formula:
=isnumber(c5)
and the same for c6 what do they both return?
The result was true
 
Upvote 0
For both?
Please sure us your data and exact formula you are trying.
That worked. Thank you! Why didn't the format change when I highlighted all the cells and applied the date fomat? Anyway, Thank you!
 
Upvote 0
That worked. Thank you! Why didn't the format change when I highlighted all the cells and applied the date fomat? Anyway, Thank you!
If you change the format of a cell and the display does not change, that usually indicates that you are dealing with a text value.
Note that changing the format of the cell does not actually change the value of the cell. You have to re-enter the value.
 
Upvote 0

Forum statistics

Threads
1,215,091
Messages
6,123,062
Members
449,089
Latest member
ikke

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top