Tech or Treat! Write an article about your scariest tech disaster to win gadgets!Learn more

x
?
Solved

Excel - getting underlying number for dates

Posted on 2011-09-06
7
Medium Priority
?
219 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:Murray Brown
[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 31

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
Independent Software Vendors: 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!

 
LVL 31

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 2000 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:Murray Brown
ID: 36517133
Thanks very much
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

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

A little background as to how I came to I design this code: Around 5 years ago I designed an add-in that formatted Excel files to a corporate standard, applying different cell colours and font type depending on whether the cells contained inputs,…
This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

647 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