Subtract dates

smide

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

I have a spreadsheet with text cells for dates (column B) in the format dd.mm.yyyy - hh:mm
I need formula to subtact two dates. Result in minutes.

example.

A​
B​
C​
1​
Date 1
10.04.2022 - 22:00​
2​
Date 2
11.04.2022 - 01:30​
3​
result (Date 2 - Date 1)
210
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
Book1
AB
1Date 110.04.2022 - 22:00
2Date 211.04.2022 - 01:30
3210
Sheet1
Cell Formulas
RangeFormula
B3B3=(DATE(MID(B2,7,4),MID(B2,4,2),LEFT(B2,2))+RIGHT(B2,5)-DATE(MID(B1,7,4),MID(B1,4,2),LEFT(B1,2))-RIGHT(B1,5))*1440
 
Upvote 0
Solution
The below worked for me but assumes that the text date is in your Local Format eg displaying dd.mm.yyyy and your local format is dd/mm/yyyy.
@Phuoc solution would work regardless eg even if your Local Format was mm/dd/yyyy

Excel Formula:
=(VALUE(SUBSTITUTE(SUBSTITUTE(B2,"- ",""),".","/"))-VALUE(SUBSTITUTE(SUBSTITUTE(B1,"- ",""),".","/")))*1440
 
Upvote 0
Or

=(SUBSTITUTE(B2," - "," ")-SUBSTITUTE(B1," - "," "))*1440 ===> 210

where in B1=10.04.2022 - 22:00 and in B2=11.04.2022 - 01:30
 
Upvote 0

Forum statistics

Threads
1,215,265
Messages
6,123,961
Members
449,135
Latest member
jcschafer209

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