Excel - getting underlying number for dates

Posted on 2011-09-06
Medium Priority
Last Modified: 2012-05-12

In Excel VBA, how do I get the integer number behind a date contained in a cell.

Question by:Murray Brown
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 18

Expert Comment

ID: 36487502
Format the cell as number. Or format a nearby cell as number and use =INT(A1)
Though you don't really need INT if you format it as a number. Probably =A1 would work as well.
LVL 43

Expert Comment

by:Saqib Husain, Syed
ID: 36487505
you can try

date * 1

for today's date number
LVL 31

Expert Comment

ID: 36487700
how do I get the integer number behind a date contained in a cell.

You mean something like
1 12/01/2011
2 24/03/2011 ???

Pls see the attached file.
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

LVL 31

Expert Comment

ID: 36487728
If on the other hand you mean the serial number of the date then if in Col A you have your date and you want the serial number in col B make sure Col B is formated as General (select Col B right click format cel and click on general in the nuber format) then in col B put in B1 =A1 and drag it down you will have the coresponding dateserial for each date in Col A
LVL 85

Accepted Solution

Rory Archibald earned 2000 total points
ID: 36487795
Use the Value2 property rather than Value.

Expert Comment

ID: 36496817
If you only need to show the serial number through VBA, you can use:

[A1].NumberFormat = "0"

Author Closing Comment

by:Murray Brown
ID: 36517133
Thanks very much

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
This article describes how you can use Custom Document Properties to store settings and other information in your workbook so that they will be available the next time you open the workbook.
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question