• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 225
  • Last Modified:

Excel - getting underlying number for dates


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

Murray Brown
Murray Brown
1 Solution
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.
Saqib Husain, SyedEngineerCommented:
you can try

date * 1

for today's date number
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.
Cloud Class® Course: MCSA MCSE Windows Server 2012

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

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
Rory ArchibaldCommented:
Use the Value2 property rather than Value.
If you only need to show the serial number through VBA, you can use:

[A1].NumberFormat = "0"
Murray BrownMicrosoft Cloud Azure/Excel Solution DeveloperAuthor Commented:
Thanks very much
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now