Time difference between date taken and time values

anmac1789

New Member
Joined
Dec 6, 2020
Messages
43
Office Version
  1. 365
Platform
  1. Windows
I have a question regarding using textsplit, match and exact functions. So, Im trying to find the time difference in seconds from the time portion of date taken and the time created, time modified and time accessed. I've tried using match, exact but somehow it doesn't seem to work. Please check my code. Thank you.


time.xlsx
ABCDEFGHIJKL
1NameSizeDay CreatedDay ModifiedDay AccessedTime CreatedTime ModifiedTime AccessedDate CreatedDate ModifiedDate AccessedDate Taken
220220727_165105.jpg673430727 Jul 2227 Jul 2227 Jul 2216:51:0516:51:0616:51:06 2022-07-27 16:51:05 2022-07-27 16:51:062022-07-27 16:51:062022-07-27 16:51:05
320220727_165105.jpg673430727 Jul 2227 Jul 2227 Jul 2216:51:0516:51:0516:51:052022-07-27 16:51:052022-07-27 16:51:052022-07-27 16:51:052022-07-27 16:51:05
4
5=TEXTSPLIT(L2," ")
62022-07-2716:51:0501
7
8=EXACT(B6,B6)
9TRUE
10
11=MATCH($G2,$G$2:$G$3,0)
121
132
Sheet1
Cell Formulas
RangeFormula
A6:B6A6=TEXTSPLIT(L2," ")
E6E6=TEXT(G2-F2,"[ss]")
A9A9=EXACT(B6,B6)
A12:A13A12=MATCH($G2,$G$2:$G$3,0)
Dynamic array formulas.
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
I may be wrong here , and only recently used textsplit -
BUT L2 is not text its a number

so in the cell will be the number 44769.7021412037 - which when formatted to DD/MM/YYYY HH:MM - it displays a date and time
BUT it is not a text with DD/MM/YYYY [space] HH:HH

so it can not split - it least not that i can.... on my version of excel

to get the date
INT(L2)
will give the date

for time
L2-INT(L2)

just showing L column - and same in M - formatted as general and date/time

format as general and you will see the numbers

the decimal part is the time section of the cell

Cell Formulas
RangeFormula
M2:M6M2=L2
L5L5=L2-INT(L2)
L6L6=INT(L2)
 
Upvote 0
I may be wrong here , and only recently used textsplit -
BUT L2 is not text its a number

so in the cell will be the number 44769.7021412037 - which when formatted to DD/MM/YYYY HH:MM - it displays a date and time
BUT it is not a text with DD/MM/YYYY [space] HH:HH

so it can not split - it least not that i can.... on my version of excel

to get the date
INT(L2)
will give the date

for time
L2-INT(L2)

just showing L column - and same in M - formatted as general and date/time

format as general and you will see the numbers

the decimal part is the time section of the cell

Cell Formulas
RangeFormula
M2:M6M2=L2
L5L5=L2-INT(L2)
L6L6=INT(L2)
When I type 27/07/2022 04:51 into a cell, I only get that text, the format can't be changed. But when I type 44769.7021412037 then it can be changed. Why won't it work the first way?

When I format as general I get #VALUE!

Even when textsplit is used on cell L2, the date portion can't be formatted into another format, because it's part of an array ? So then whats the workaround for that ?
 
Last edited:
Upvote 0
ok,
entered into a cell
usually Excel would recognise that as a date and change to show date/time - but underlaying would be a number
possibly the way excel is seeing the date - not sure why

what country are you in and using excel - possibly a pc settings


Also the text is justified to the left and number to the right

as shown

dont know if this helps
sort.xlsx
AB
1TEXTDATE
219/10/22 21:5010/19/22 21:50
319/10/22 21:5044853.90972
4
5
6Text split - A2
719/10/2221:50
8
9
10text split B2
1144853.9097222222
Sheet1
Cell Formulas
RangeFormula
A3:B3A3=A2
A7:B7A7=TEXTSPLIT(A2," ")
A11A11=TEXTSPLIT(B2," ")
Dynamic array formulas.
 
Upvote 0

ok,
entered into a cell
usually Excel would recognise that as a date and change to show date/time - but underlaying would be a number
possibly the way excel is seeing the date - not sure why

what country are you in and using excel - possibly a pc settings


Also the text is justified to the left and number to the right

as shown

dont know if this helps
sort.xlsx
AB
1TEXTDATE
219/10/22 21:5010/19/22 21:50
319/10/22 21:5044853.90972
4
5
6Text split - A2
719/10/2221:50
8
9
10text split B2
1144853.9097222222
Sheet1
Cell Formulas
RangeFormula
A3:B3A3=A2
A7:B7A7=TEXTSPLIT(A2," ")
A11A11=TEXTSPLIT(B2," ")
Dynamic array formulas.
excel version.png


This is the version I am using currently and I am in Ontario, Canada. This is very strange, I dont know what to do. Even if the original data had 10/19/22 21:50, splitting it would generate 10/19/22 and 21:50 but the date can't be formatted? isn't that a bit wierd...
 
Last edited:
Upvote 0
whats the default date format used in canada on the PC
Hows it shown on the PC date time - window

IN UK and
my default system format is DD / MM /YYYY

so if i enter 11/27/22 - then thats not recognised as a date - because cant have 27 th MONTH
but if i enter

27/11/22 - then its seen as a date

could it be that ?
 
Upvote 0
whats the default date format used in canada on the PC
Hows it shown on the PC date time - window

IN UK and
my default system format is DD / MM /YYYY

so if i enter 11/27/22 - then thats not recognised as a date - because cant have 27 th MONTH
but if i enter

27/11/22 - then its seen as a date

could it be that ?
The default date format is yyyy-mm-dd
 
Upvote 0
and when you enter

in this order

2022-10-19

is that a date or text
 
Upvote 0
so is recognised as a date and can be formatted into any format

i suspect this is the issue
When I type 27/07/2022 04:51 into a cell, I only get that text,
you are entering a date format

27/07/2022 - but your excel system is expecting YYYY-MM-DD
and so it assumes its TEXT and NOT a number

like my system does when trying to enter MM/DD/YY
if i enter
10/19/22 - it right justifies and nolonger a real date BUT text - because excel is expecting a MONTH and 19 is NOT a month and so it must be a date
like if i wanted to enter 1st June 22
01/07/22
but if i entered it in that format assuming it should show 7th Jan - as a US date MM/DD
it will be seen as a date - BUT the wrong date

see this a lot with US systems outputing into excel - well a lot of dates are real - BUT wrong and others are TEXT
a couple of questions even yesterday on the forum because of that issue

so if its seen as text , as i showed
TEXTSPLIT works
BUT not when its entered and recognised as a date

I dont feel i have explained that well
 
Upvote 0

Forum statistics

Threads
1,216,163
Messages
6,129,223
Members
449,495
Latest member
janzablox

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