Subtract dates

smide

Board Regular
Joined
Dec 20, 2015
Messages
164
Office Version
  1. 2016
Platform
  1. Windows
Hello.




In cell A1 I have current date created with formula =today() eg. 3-Oct-2019.
In the same column starting from cell A3 (A3:A600) I have dates and time in format dd.mm.yyyy - hh:mm (example. 04.10.2019 - 21:00).


All those cells (A3:A600) are text cells. I need to subtract all those dates (A3:A600) and current date. Result(s) should be the difference expressed in days (column B).


example.

[TABLE="class: grid, width: 500, align: center"]
<tbody>[TR]
[TD][/TD]
[TD="align: center"]A[/TD]
[TD="align: center"]B[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]
3-Oct-2019
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD="align: center"]30.09.2019 - 17:30[/TD]
[TD="align: center"]-3[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD="align: center"]01.10.2019 - 22:00[/TD]
[TD="align: center"]-2[/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD="align: center"]02.10.2019 - 16:00[/TD]
[TD="align: center"]-1[/TD]
[/TR]
[TR]
[TD]6[/TD]
[TD="align: center"]02.10.2019 - 21:00[/TD]
[TD="align: center"]-1[/TD]
[/TR]
[TR]
[TD]7[/TD]
[TD="align: center"]03.10.2019 - 12:00[/TD]
[TD="align: center"]0[/TD]
[/TR]
[TR]
[TD]8[/TD]
[TD="align: center"]04.10.2019 - 16:45[/TD]
[TD="align: center"]1[/TD]
[/TR]
[TR]
[TD]9[/TD]
[TD="align: center"]05.10.2019 - 13:00[/TD]
[TD="align: center"]2[/TD]
[/TR]
</tbody>[/TABLE]

 
Last edited:

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
Hi, you may need to format the cells that contain the formula as general or number.


Excel 2013/2016
AB
1
203-Oct-19
3
430.09.2019 - 17:30-3
501.10.2019 - 22:00-2
602.10.2019 - 16:00-1
702.10.2019 - 21:00-1
803.10.2019 - 12:000
904.10.2019 - 16:451
1005.10.2019 - 13:002
Sheet1
Cell Formulas
RangeFormula
A2=TODAY()
B4=SUBSTITUTE(LEFT(A4,10),".","/")-$A$2
 
Upvote 0
Tried everything but unfortunately I'm getting only error (#VALUE!) as a result...:confused:
 
Upvote 0
Tried everything but unfortunately I'm getting only error (#VALUE!) as a result...:confused:

Let's try a method that is not susceptible to regional date/time settings.


Excel 2013/2016
AB
103/10/2019
2
330.09.2019 - 17:30-3
401.10.2019 - 22:00-2
502.10.2019 - 16:00-1
602.10.2019 - 21:00-1
703.10.2019 - 12:000
804.10.2019 - 16:451
905.10.2019 - 13:002
Sheet1
Cell Formulas
RangeFormula
B3=DATE(MID(A3,7,4),MID(A3,4,2),LEFT(A3,2))-$A$1
 
Last edited:
Upvote 0

Forum statistics

Threads
1,226,694
Messages
6,192,473
Members
453,726
Latest member
JoeH57

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