Solved

Excel - getting underlying number for dates

Posted on 2011-09-06
7
206 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
[X]
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
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 30

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
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 
LVL 30

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

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

Suggested Solutions

This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.

734 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