Pre 1900 day date calculations

huge

New Member
Joined
Jan 1, 2012
Messages
3
Hello folks,

I am looking for help to work with pre 1900 dates by adding days.
As an example i have a date of 1 Jan 1788 and would like to add (x) days to it working toward 1 Jan 1900 in multiples of (x) days when Excel starts to work.

7 Feb 1788 plus (50 days) = 28 March 1788.
28 March 1788 plus (50 days) = 16 May 1788.
16 May 1788 plus (50 days) = 4 July 1788.
etc, etc

Thank you
Huge
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
place these functions into a module then type 7 feb 1788 into a cell next cell down type =Xdateadd(select cell above, 50) this will return the short date for your computer if you want a different format put another comma after the 50 and "dd mm yyyy"
or what ever format you want then drag down.

Code:
Function XDATEADD(xdate1, days, Optional fmt As String) As String
    Dim TempDate As Date
    If IsMissing(fmt) Then fmt = "Short Date"
    xdate1 = RemoveDay(xdate1)
    TempDate = DateValue(xdate1)
    XDATEADD = Format(TempDate + days, fmt)
End Function


Private Function RemoveDay(xdate1)
'   Remove day of week from string
    Dim i As Integer
    Dim Temp As String
    Temp = xdate1
    For i = 0 To 6 'Unabbreviated day names
        Temp = Application.Substitute(Temp, Format(DateSerial(1900, 1, 0), "dddd"), "")
    Next i
    For i = 0 To 6 'Abbreviated day names
        Temp = Application.Substitute(Temp, Format(DateSerial(1900, 1, 0), "ddd"), "")
    Next i
    RemoveDay = Temp
End Function
 
Upvote 0

Forum statistics

Threads
1,223,901
Messages
6,175,277
Members
452,629
Latest member
SahilPolekar

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