Home

pre-1900 dates

%3CLINGO-SUB%20id%3D%22lingo-sub-129999%22%20slang%3D%22en-US%22%3Epre-1900%20dates%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-129999%22%20slang%3D%22en-US%22%3E%3CP%3EI%20can%20find%20no%20help%20on%20how%20to%20tell%20Excel%20to%20properly%20format%20and%20calculate%20dates%20before%201900.%26nbsp%3B%20I%20want%20to%20calculate%20age%20at%20death%20and%20have%20birth%20and%20death%20dates%20in%20columns.%26nbsp%3B%20But%20Excel%20does%20not%20recognize%20March%2030%2C%201894.%26nbsp%3B%20It%20calls%20is%20YYYY%20%3D%203794.%26nbsp%3B%20And%20subtracting%20death%20date%20from%20birth%20date%20returns%20%22%23VALUE!%22%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EHow%20do%20I%20use%20the%20DATE(YYYY%2CMM%2CDD)%20function%20or%20format%20March%2030%2C%201894%20so%20Excel%20will%20understand%20and%20I%20can%20have%20it%20calculate%20the%20age%20at%20death%20correctly%3F%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ETIA.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAlso%20I've%20seen%20%231%20shown%20in%20Excel%20Help%20in%20different%20posts%20as%20BOTH%20Dec%2031%2C%201899%20AND%20as%20Jan%201%2C%201900.%26nbsp%3B%20Which%20is%20it%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-129999%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%20Desktop%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EFormulas%20%26amp%3B%20Functions%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-131212%22%20slang%3D%22en-US%22%3ERe%3A%20pre-1900%20dates%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-131212%22%20slang%3D%22en-US%22%3E%3CP%3EAs%20a%20comment%3C%2FP%3E%0A%3CP%3E-%20dates%20in%20Excel%20are%20actually%20integer%20numbers%20where%201%20is%20equal%20to%20Jan%2001%2C%201900%20(if%20we%20speak%20about%20PC%20version).%20However%2C%20if%20format%20zero%20as%20date%20it%20will%20be%20returned%20as%20Jan%2000%2C%201900%20which%20could%20be%20interpreted%20as%20Dec%2031%2C%201899.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E-%20there%20are%20quite%20many%20techniques%20how%20to%20work%20with%20dates%20before%201900.%20Since%20such%20dates%20are%20interpreted%20as%20text%20it%26nbsp%3Bvery%20depends%20on%20in%20which%20format%20your%20dates%20are%20presented%20since%20in%20any%20case%20you%20need%20to%20parse%20your%20text%20to%20substruct%20element%20of%20the%20date%20(year%2C%20month%2C%20day)%2C%20convert%20to%20numbers%20and%20compare%20with%20another%20date%20(which%20is%20the%20number%20if%20after%201900%20or%20another%20text).%20Or%20by%20adding%20few%20thousand%20of%20years%20to%20each%20date.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E-%20if%20some%26nbsp%3Bdates%20are%20before%20shifting%20from%20Julian%20on%20Georgian%20calendar%20that%20also%20shall%20be%20taken%20into%20account%20adjusting%20the%20result%20on%20the%20days%20of%20shift.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E-%20all%20above%20could%20be%20done%20in%20few%20ways%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3Eby%20different%20kind%20of%20formulas%20(google%20will%20provide%20the%20samples)%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3Ewith%20using%20VBA.%20The%20starting%20point%20could%20be%20Microsoft%20sample%20%3CA%20href%3D%22https%3A%2F%2Fsupport.microsoft.com%2Fen-us%2Fhelp%2F245104%2Fhow-to-calculate-ages-before-1-1-1900-in-excel%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3EHow%20to%20calculate%20ages%20before%201%2F1%2F1900%20in%20Excel%3C%2FA%3E%26nbsp%3Bor%20you%20may%20generate%20your%20own%20macro%20taking%20into%20account%20what%20built-in%20VBA%20function%20DateDiff%20works%20correctly%20with%20dates%20starting%20from%20year%20100%20(if%20dates%20text%20representation%20is%20in%20your%20locale%20format).%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3Eusing%20Power%20Query%20(Get%26amp%3BTransform).%20It%20correctly%20interprets%20dates%20before%201900%20if%20convert%20them%20from%20text%20to%20date.%20The%20only%20point%20of%20final%20step%20after%20you%20calculate%20durations%20not%20to%20forget%20return%20format%20back%20to%20text%20before%20loading%20resulting%20table%20into%20the%20Excel%20sheet.%20Power%20Query%20even%20recognizes%20the%20dates%20if%20the%20text%20is%20in%20long%2Fshort%20date%20formats%20like%20December%2025%2C%201865.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-131023%22%20slang%3D%22en-US%22%3ERe%3A%20pre-1900%20dates%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-131023%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F96754%22%20target%3D%22_blank%22%3E%40John%20Albertini%3C%2FA%3E%26nbsp%3BSounds%20interesting!%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAs%20we%20know%20Excel%20doesn't%20recognize%20date%20before%201900%2C%20but%20here%20I%20have%20a%20solution%20for%20you%2C%20it%20works%20perfectly!.%20using%20the%20formula%20you%20can%20calculate%20any%20date%20even%20year%201!.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIt's%20not%20original%20from%20me%2C%20I%20found%20it%20here%26nbsp%3B%3CA%20href%3D%22http%3A%2F%2Ftips-rumus-excel.blogspot.co.id%2F2015%2F01%2Fdates-before-1900.html%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttp%3A%2F%2Ftips-rumus-excel.blogspot.co.id%2F2015%2F01%2Fdates-before-1900.html%3C%2FA%3E%26nbsp%3Bbut%20that's%20Indonesian%20version%2C%20so%20I%20modify%20some%20of%20the%20formula%20to%20English%20Version%20(such%20as%20%22Year%22%20in%20Indonesian%20is%20%22Tahun%22%20and%20so%20on.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-130015%22%20slang%3D%22en-US%22%3ERe%3A%20pre-1900%20dates%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-130015%22%20slang%3D%22en-US%22%3E%3CP%3EJohn%2C%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EI%20can%20offer%20you%20formula%20%231%20on%20excelformeln.de%3A%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22http%3A%2F%2Fwww.excelformeln.de%2Fformeln.html%3Fwelcher%3D1%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3EDifference%20of%20dates%20before%201900%20%2F%20a.c.n.%3C%2FA%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-777838%22%20slang%3D%22en-US%22%3ERe%3A%20pre-1900%20dates%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-777838%22%20slang%3D%22en-US%22%3E%3CP%3E%3CSTRONG%3EA%20very%20simple%20solution%20would%20be%20to%20just%20add%20an%20offset%20to%20both%20of%20the%20dates%20to%20be%20compared%2C%20so%20that%20a%20difference%20can%20then%20be%20calculated%20using%20the%20given%20Excel%20functions%20which%20start%20after%201900.%26nbsp%3B%202000%20years%20would%20include%20the%20repeating%20leap%20year%20dates%2C%20so%26nbsp%3Bshould%20be%26nbsp%3Ba%20good%20value%20to%20offset.%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSTRONG%3EThus%2C%209%2F14%2F1752%2012%3A00%20am%20(date%20of%20Gregorian%20calendar%20acceptance)%20would%20be%20entered%20as%209%2F14%2F3752.%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3E%3CSTRONG%3E1%2F6%2F1980%2012%3A00%20am%20(0%20time%20reference%20for%20GPS)%20would%20be%20entered%20as%201%2F6%2F3980.%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3E%3CSTRONG%3EThe%20difference%20can%20then%20be%20calculated%20straightforward%20in%20Excel%20using%20the%20DAYS%20function%2C%20or%20just%20subtracting%20the%20earlier%20from%20the%20later%20date.%20(%3D83020%20days%2C%20or%20227.31x%20years%20at%20365.24%20days%2Fyr).%26nbsp%3B%20%3C%2FSTRONG%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-778019%22%20slang%3D%22en-US%22%3ERe%3A%20pre-1900%20dates%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-778019%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F521%22%20target%3D%22_blank%22%3E%40Sergei%20Baklan%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHow%20do%20you%20do%20the%20conversion%20Sergei%2C%20in%20Power%20Query%3C%2FP%3E%3CP%3EI%20tried%20to%20do%20it%20but%20PQ%20returned%20an%20error%20when%20I%20changed%20the%20data%20type%20for%20dates%20prior%20to%201900%20from%20Txt%20to%20Date.%3C%2FP%3E%3CP%3EI%20want%20to%20learn%20this%20part%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F124840i83486149EA67BFA4%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22PQ%20dates.png%22%20title%3D%22PQ%20dates.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3EThanks%3C%2FP%3E%3CP%3ENabil%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-778076%22%20slang%3D%22en-US%22%3ERe%3A%20pre-1900%20dates%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-778076%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F365248%22%20target%3D%22_blank%22%3E%40nabilmourad%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3ETo%20interpret%20the%20number%20that%20is%20entered%20as%20text%20(for%20pre-1900%20dates)%20I%20assume%20you%20would%20have%20to%20use%20the%20text%20separator%20functions%20using%20the%20%22%2F%22%20symbols%20to%20separate%20the%20YYYY%2FMM%2FDD%20into%20individual%20elements%20YYYY%2C%20MM%2C%20DD.%26nbsp%3B%20Then%20add%202000%20to%20the%20pre-1900%20YYYY%20to%20make%20it%20readable%20by%20Excel%20DATE%20functions.%26nbsp%3B%20Then%20concatenate%20back%20to%20YYYY%2FMM%2FDD%20in%20the%20time%20shifted%20date.%20Then%20if%20want%20to%20do%20a%20comparison%20to%20other%20dates%2C%20could%20just%20offset%20the%20newer%20date%20%2B2000%20years%20also%20before%20comparing%20them.%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-778086%22%20slang%3D%22en-US%22%3ERe%3A%20pre-1900%20dates%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-778086%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F365248%22%20target%3D%22_blank%22%3E%40nabilmourad%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ENabil%2C%20please%20check%20attached%20file.%20It%20calculates%20number%20of%20days%20from%20given%20date%20to%20today%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20419px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F124850iC7C5EFD02DFDBC3A%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22image.png%22%20title%3D%22image.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EGenerated%20script%20is%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-ruby%22%3E%3CCODE%3Elet%0A%20%20%20%20Source%20%3D%20Excel.CurrentWorkbook()%7B%5BName%3D%22Table1%22%5D%7D%5BContent%5D%2C%0A%20%20%20%20TextToDate%20%3D%20Table.TransformColumnTypes(%0A%20%20%20%20%20%20%20%20Source%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7B%22A%22%2C%20type%20text%7D%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7B%22Date%22%2C%20type%20date%7D%0A%20%20%20%20%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20)%2C%0A%20%20%20%20DatesFrom%20%3D%20Table.AddColumn(%0A%20%20%20%20%20%20%20%20TextToDate%2C%0A%20%20%20%20%20%20%20%20%22DaysToToday%22%2C%0A%20%20%20%20%20%20%20%20each%20Number.From(Date.From(DateTime.LocalNow())-%5BDate%5D)%2C%0A%20%20%20%20%20%20%20%20Int64.Type%0A%20%20%20%20)%2C%0A%20%20%20%20BackToText%20%3D%20Table.TransformColumnTypes(%0A%20%20%20%20%20%20%20%20DatesFrom%2C%0A%20%20%20%20%20%20%20%20%7B%7B%22Date%22%2C%20type%20text%7D%7D%0A%20%20%20%20)%0Ain%0A%20%20%20%20BackToText%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-778147%22%20slang%3D%22en-US%22%3ERe%3A%20pre-1900%20dates%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-778147%22%20slang%3D%22en-US%22%3E%3CP%3E%3CSTRONG%3ENote%20that%20if%20you%20need%20to%20determine%20the%20EXACT%20number%20of%20days%20including%20leap%20years%2C%20I%20don't%20think%20the%20macro%20function%20that%20subtracts%20YYYY-YYYY%2C%20MM-MM%2C%20DD-DD%20to%20determine%20a%20difference%20will%20do%20that%20as%20written%2C%20whereas%20the%20DATE%20function%20within%20Excel%20will%20(when%20both%20dates%20are%20converted%20to%20post%201900%20dates).%26nbsp%3B%20You%20could%20use%20365.24%20days%20as%20an%20approximate%20yearly%20equivalent%2C%20instead%20of%20365%2C%20then%20truncate%20the%20value%20to%20get%20an%20integer%20number%20of%20days.%3C%2FSTRONG%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-778213%22%20slang%3D%22en-US%22%3ERe%3A%20pre-1900%20dates%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-778213%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F521%22%20target%3D%22_blank%22%3E%40Sergei%20Baklan%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHi%20Sergei%2C%3C%2FP%3E%3CP%3EWhen%20I%20opened%20your%20file%20on%20my%20office%202016%20it%20gave%20me%20a%20notification%20that%20it%20was%20created%20with%20a%20more%20recent%20version.%20So%2C%20that%20explains%20why%20I%20got%20the%20error%20column%20when%20I%20used%20PQ.%3C%2FP%3E%3CP%3EI%20switched%20to%20my%20other%20computer%20with%20Office%20365%20Pro%20Plus%20(with%20office%20insider)%20and%20everything%20worked%20just%20fine.%3C%2FP%3E%3CP%3EThanks%3C%2FP%3E%3CP%3ENabil%20Mourad%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-778219%22%20slang%3D%22en-US%22%3ERe%3A%20pre-1900%20dates%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-778219%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F365248%22%20target%3D%22_blank%22%3E%40nabilmourad%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ENabil%2C%20my%20first%20post%20in%20this%20thread%20is%20back%20in%202017%20and%20such%20data%20conversion%20definitely%20worked%20at%20that%20time.%20A.D.%20dates%20in%20Power%20Query%20are%20by%20design%20from%20scratch.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20only%2C%20perhaps%20conversion%20required%20dates%20are%20to%20be%20in%20your%20locale%20format%2C%20I%20don't%20remember.%20At%20least%20now%20it%20doesn't%20matter.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-778021%22%20slang%3D%22en-US%22%3ERe%3A%20pre-1900%20dates%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-778021%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F383857%22%20target%3D%22_blank%22%3E%40molokevcat%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHi%3C%2FP%3E%3CP%3EHow%20do%20you%20originally%20add%20any%20number%20to%20a%20date%20that%20is%20perceived%20as%20text%3F%3C%2FP%3E%3CP%3EIt%20returns%20a%20%23Value%20error%3C%2FP%3E%3CP%3EPlease%20explain%3C%2FP%3E%3CP%3EThanks%3C%2FP%3E%3CP%3ENabil%20Mourad%3C%2FP%3E%3C%2FLINGO-BODY%3E
John Albertini
Occasional Visitor

I can find no help on how to tell Excel to properly format and calculate dates before 1900.  I want to calculate age at death and have birth and death dates in columns.  But Excel does not recognize March 30, 1894.  It calls is YYYY = 3794.  And subtracting death date from birth date returns "#VALUE!" 

 

How do I use the DATE(YYYY,MM,DD) function or format March 30, 1894 so Excel will understand and I can have it calculate the age at death correctly?

 

TIA.

 

Also I've seen #1 shown in Excel Help in different posts as BOTH Dec 31, 1899 AND as Jan 1, 1900.  Which is it?

11 Replies

John,

 

I can offer you formula #1 on excelformeln.de:

Difference of dates before 1900 / a.c.n.

@John Albertini Sounds interesting!

 

As we know Excel doesn't recognize date before 1900, but here I have a solution for you, it works perfectly!. using the formula you can calculate any date even year 1!.

 

It's not original from me, I found it here http://tips-rumus-excel.blogspot.co.id/2015/01/dates-before-1900.html but that's Indonesian version, so I modify some of the formula to English Version (such as "Year" in Indonesian is "Tahun" and so on.

As a comment

- dates in Excel are actually integer numbers where 1 is equal to Jan 01, 1900 (if we speak about PC version). However, if format zero as date it will be returned as Jan 00, 1900 which could be interpreted as Dec 31, 1899.

 

- there are quite many techniques how to work with dates before 1900. Since such dates are interpreted as text it very depends on in which format your dates are presented since in any case you need to parse your text to substruct element of the date (year, month, day), convert to numbers and compare with another date (which is the number if after 1900 or another text). Or by adding few thousand of years to each date.

 

- if some dates are before shifting from Julian on Georgian calendar that also shall be taken into account adjusting the result on the days of shift.

 

- all above could be done in few ways

 

by different kind of formulas (google will provide the samples)

 

with using VBA. The starting point could be Microsoft sample How to calculate ages before 1/1/1900 in Excel or you may generate your own macro taking into account what built-in VBA function DateDiff works correctly with dates starting from year 100 (if dates text representation is in your locale format). 

 

using Power Query (Get&Transform). It correctly interprets dates before 1900 if convert them from text to date. The only point of final step after you calculate durations not to forget return format back to text before loading resulting table into the Excel sheet. Power Query even recognizes the dates if the text is in long/short date formats like December 25, 1865.

A very simple solution would be to just add an offset to both of the dates to be compared, so that a difference can then be calculated using the given Excel functions which start after 1900.  2000 years would include the repeating leap year dates, so should be a good value to offset.

 

Thus, 9/14/1752 12:00 am (date of Gregorian calendar acceptance) would be entered as 9/14/3752.

1/6/1980 12:00 am (0 time reference for GPS) would be entered as 1/6/3980.

The difference can then be calculated straightforward in Excel using the DAYS function, or just subtracting the earlier from the later date. (=83020 days, or 227.31x years at 365.24 days/yr). 

@Sergei Baklan 

How do you do the conversion Sergei, in Power Query

I tried to do it but PQ returned an error when I changed the data type for dates prior to 1900 from Txt to Date.

I want to learn this part

PQ dates.png

Thanks

Nabil

@molokevcat 

Hi

How do you originally add any number to a date that is perceived as text?

It returns a #Value error

Please explain

Thanks

Nabil Mourad

@nabilmourad 

To interpret the number that is entered as text (for pre-1900 dates) I assume you would have to use the text separator functions using the "/" symbols to separate the YYYY/MM/DD into individual elements YYYY, MM, DD.  Then add 2000 to the pre-1900 YYYY to make it readable by Excel DATE functions.  Then concatenate back to YYYY/MM/DD in the time shifted date. Then if want to do a comparison to other dates, could just offset the newer date +2000 years also before comparing them. 

@nabilmourad 

Nabil, please check attached file. It calculates number of days from given date to today

image.png

Generated script is

let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    TextToDate = Table.TransformColumnTypes(
        Source,
            {
                {"A", type text},
                {"Date", type date}
            }
    ),
    DatesFrom = Table.AddColumn(
        TextToDate,
        "DaysToToday",
        each Number.From(Date.From(DateTime.LocalNow())-[Date]),
        Int64.Type
    ),
    BackToText = Table.TransformColumnTypes(
        DatesFrom,
        {{"Date", type text}}
    )
in
    BackToText

 

Note that if you need to determine the EXACT number of days including leap years, I don't think the macro function that subtracts YYYY-YYYY, MM-MM, DD-DD to determine a difference will do that as written, whereas the DATE function within Excel will (when both dates are converted to post 1900 dates).  You could use 365.24 days as an approximate yearly equivalent, instead of 365, then truncate the value to get an integer number of days.

@Sergei Baklan 

Hi Sergei,

When I opened your file on my office 2016 it gave me a notification that it was created with a more recent version. So, that explains why I got the error column when I used PQ.

I switched to my other computer with Office 365 Pro Plus (with office insider) and everything worked just fine.

Thanks

Nabil Mourad

@nabilmourad 

Nabil, my first post in this thread is back in 2017 and such data conversion definitely worked at that time. A.D. dates in Power Query are by design from scratch.

 

The only, perhaps conversion required dates are to be in your locale format, I don't remember. At least now it doesn't matter.