ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Converting date to numerical and doing calculations (https://www.excelbanter.com/excel-worksheet-functions/48870-converting-date-numerical-doing-calculations.html)

Teddy

Converting date to numerical and doing calculations
 
Does anyone know how to convert a date into a single number so that you
can do calcuations with it? For example, Nov,2005 minus January, 2004
equals 23.


Duke Carey

I'm guessing that you are counting months between two dates, right?

Take a look at Chip Pearson's site about dates and date calculations:

http://www.cpearson.com/excel/datedif.htm


"Teddy" wrote:

Does anyone know how to convert a date into a single number so that you
can do calcuations with it? For example, Nov,2005 minus January, 2004
equals 23.



Myrna Larson

Dates ARE stored as numbers, specifically the number of elapsed days since Dec
31, 1899. If you want the difference in months, you can use the undocumented
DATEDIF function: =DATEDIF(A1,B1,"m")


On 5 Oct 2005 12:58:43 -0700, "Teddy" wrote:

Does anyone know how to convert a date into a single number so that you
can do calcuations with it? For example, Nov,2005 minus January, 2004
equals 23.


bill k


dates are actually stored as normal numbers

for instance

a2 has 23/01/2005
a1 has 12/11/2004
both formatted as dates

if you would copy paste and format the pasted cells as numbers you see

that 23/01/2005 is now 38375 and 12/11/2004 is 38303

in a3 enter =a2-a1
formatted as number
result 72

in a4 enter =a1-a2
formatted as number
result -72

if result is ############### then the cell is still formatted as a date
and
you have a negative "date"


--
bill k


------------------------------------------------------------------------
bill k's Profile: http://www.excelforum.com/member.php...nfo&userid=821
View this thread: http://www.excelforum.com/showthread...hreadid=473575



All times are GMT +1. The time now is 12:31 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com