Solved

Excel - getting underlying number for dates

Posted on 2011-09-06
7
180 Views
Last Modified: 2012-05-12
Hi

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

Thanks
0
Comment
Question by:murbro
7 Comments
 
LVL 18

Expert Comment

by:Cluskitt
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.
0
 
LVL 43

Expert Comment

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

date * 1

for today's date number
0
 
LVL 29

Expert Comment

by:gowflow
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.
gowflow
Date-number.xls
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 29

Expert Comment

by:gowflow
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
gowflow
0
 
LVL 85

Accepted Solution

by:
Rory Archibald earned 500 total points
ID: 36487795
Use the Value2 property rather than Value.
0
 
LVL 1

Expert Comment

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

[A1].NumberFormat = "0"
0
 

Author Closing Comment

by:murbro
ID: 36517133
Thanks very much
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Improved? Move/Copy Add-in Replacement - How to avoid the annoying, “A formula or sheet you want to move or copy contains the name XXX, which already exists on the destination worksheet.” David Miller (dlmille)  It was one of those days… I wa…
Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
The view will learn how to download and install SIMTOOLS and FORMLIST into Excel, how to use SIMTOOLS to generate a Monte Carlo simulation of 30 sales calls, and how to calculate the conditional probability based on the results of the Monte Carlo …
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.

930 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now