Calculate date difference without datedif function

TheWes

New Member
Joined
Sep 20, 2024
Messages
18
Office Version
  1. 2016
Platform
  1. Windows
Hi guys,

I want to calculate the difference between a start date of absence and recovery date.
Below is a snip from my current dataset.

few things:
1. Datedif doesnt
2. nor subtracting both from each other and divide by 7.

I probaly need to convert them. Will follow-up but could use some tips
Thank you!

Week of Day First Start Date AbsenceWeek of Recovery Date Absence
June 10, 202400/01/1900
November 27, 2023December 2, 2024
May 20, 2024July 1, 2024
February 12, 2024February 19, 2024
July 17, 2023July 24, 2023
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
seems like the dates are text and NOT real dates
if you change the format to general , do you get a number ?

and you are using 2016 version
 
Upvote 0
This is not a real date: 00/01/1900, but DATEDIF works fine.
Book1
ABCD
1Week of Day First Start Date AbsenceWeek of Recovery Date AbsenceDaysDivide by 7
26/10/202400/01/1900#VALUE!#VALUE!
311/27/202312/2/202437153
45/20/20247/1/2024426
52/12/20242/19/202471
67/17/20237/24/202371
Sheet4
Cell Formulas
RangeFormula
C2:C6C2=DATEDIF(--A2,--B2,"d")
D2:D6D2=C2/7
 
Upvote 0
seems like the dates are text and NOT real dates
if you change the format to general , do you get a number ?

and you are using 2016 version
yes I am using 2016 Excel.

So I changed the output of the data and I changed it to general but I will seem to at times weird output:
- the first 2 columns is the raw output
- the last 2 columns is when I put format on general. As you can tell sometimes it gives me a number and sometimes just the date. The date is in mm/dd/yyyy form, which I am not able to change it seems.

Any thoughts?
Thank you
Araw dateset:
Day First Start Date AbsenceRecovery Date AbsenceDay First Start Date AbsenceRecovery Date Absence
9/16/201812/21/20239/16/201812/21/2023
12/25/202312/30/202312/25/202312/30/2023
07/05/2024045419
07/07/202407/10/20244548045572
10/31/202411/04/202410/31/202445393
11/26/2023011/26/2023
03/08/202403/10/20244550745568
06/05/202406/09/20244541845541
10/12/202410/21/20244563610/21/2024
02/01/202302/06/20234492845079
4/26/202304/26/2023
01/11/20231/26/2023452311/26/2023
 
Upvote 0
thats probably because when it imports it recognises the dates and some not
so if you have a DD/MM/YYYY setting then things like 9/16/23 - would not work as it thinks its the 16th Month
hence why a mixture of dates
Also
if the date is 12th March 24 - 12/3/24 - in UKK format - That may be read as 3rd december in US - so the Date is wrong when its imported

What are you using to import
IT maybe worth using the import wizard and making sure ALL the dates are imported as TEXT - so you dont get WRONG dates displayed
and then using a combination of MID() left() Right() and & with a datevalue() to convert

I'm assuming US format - as would only expect a few days between column A and B

can you confirm what format you use
MM/DD/YYYY
 
Upvote 0
@TheWes I'm a bit confused, does your actual data for the first 2 columns appear as you have them in post 4 i.e. numbers separated by a / or are some of them words and numbers as in post 1 (if they are text then they wouldn't have changed to numbers separated by a /)
 
Upvote 0

Forum statistics

Threads
1,225,201
Messages
6,183,535
Members
453,168
Latest member
Luggsy

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