Jul 31 2021 11:00 PM
I have this data, 10 7 2021 10:00(d m yyyy h:mm) without "/" or "-" just space between in A2,
and 11 7 2021 10:00 in B2 I just trying this =(A2-B2)+1 but can't, i already try custom format but still
question:
1. date must have "/" or "-"?
2. can i just change my data without change it manually? i have very much data
Please Help
Jul 31 2021 11:36 PM
Aug 01 2021 12:11 AM - edited Aug 01 2021 12:12 AM
@Rian_Pramana You mention the you have "very much data". That suggests that PowerQuery (PQ) is the solution to your problem. If you have never used it before it may be a bit overwhelming to get started. But once you master the basics, a new world will open up and it will change the way how you work with data in Excel in the future.
PQ allows you to connect to your raw data, transform and clean it and create a usable format, do calculations and create the kind of output you described. The attached file is how it could look like.
Columns A and B hold text data like in your example. The green table was created by PQ.
By the way, in your question you mentioned a formula like A-B+1. With dates/times in column B that are after the ones in column A, that didn't seem to make much sense. So, in the attached example I calculated duration as B - A.
Aug 01 2021 01:59 AM
Solution@Rian_Pramana as @Riny_van_Eekelen said, using power query is the most efficient way to handle this scenario.
One other way you may try
A | B | C | D |
In | In Date | In Time | In Combined |
10 7 2021 10:10 | 10 7 2021 | 10:10 | 10-7-2021 10:10 |
Hope this helps.
Aug 01 2021 06:56 AM
Aug 01 2021 06:58 AM
Aug 01 2021 01:31 PM
If default date format is d/m/yyyy when
=SUBSTITUTE(SUBSTITUTE(B2, " ","/",1), " ","/",1)-
SUBSTITUTE(SUBSTITUTE(A2, " ","/",1), " ","/",1)
Aug 01 2021 01:59 AM
Solution@Rian_Pramana as @Riny_van_Eekelen said, using power query is the most efficient way to handle this scenario.
One other way you may try
A | B | C | D |
In | In Date | In Time | In Combined |
10 7 2021 10:10 | 10 7 2021 | 10:10 | 10-7-2021 10:10 |
Hope this helps.