Solved

Excel - getting underlying number for dates

Posted on 2011-09-06
7
189 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
ScreenConnect 6.0 Free Trial

At ScreenConnect, partner feedback doesn't fall on deaf ears. We collected partner suggestions off of their virtual wish list and transformed them into one game-changing release: ScreenConnect 6.0. Explore all of the extras and enhancements for yourself!

 
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

ScreenConnect 6.0 Free Trial

Check out the updates in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI that improves session organization and overall user experience. See the enhancements for yourself!

Question has a verified solution.

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

Suggested Solutions

Convert between Excel file formats (.XLS, .XLSX, .XLSM) with/without macro option David Miller (dlmille) Intro Over this past Fall, I've had the opportunity to see several similar requests and have developed a couple related solutions associate…
How to quickly and accurately populate Word documents with Excel data, charts and images (including Automated Bookmark generation) David Miller (dlmille) Synopsis In this article you’ll learn how to use ExcelToWord! to copy data,charts, shapes …
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.

778 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