ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Formatting a date as a serial number (https://www.excelbanter.com/excel-programming/280777-formatting-date-serial-number.html)

David

Formatting a date as a serial number
 
How can I return a formatted date as a serial number in
Excel 97?

FormatNumber(TheDate) works in Excel 2002, but is not
supported in Excel 97.

David


Ron de Bruin

Formatting a date as a serial number
 
Use the Format function

MsgBox Format(Range("a1"), "0")


--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)
www.rondebruin.nl



"David" wrote in message ...
How can I return a formatted date as a serial number in
Excel 97?

FormatNumber(TheDate) works in Excel 2002, but is not
supported in Excel 97.

David




Tom Ogilvy

Formatting a date as a serial number
 
? FormatNumber(date)
37,922.00
? format(date,"##,###.00")
37,922.00
? cdbl(date)
37922


--
Regards,
Tom Ogilvy

"David" wrote in message
...
How can I return a formatted date as a serial number in
Excel 97?

FormatNumber(TheDate) works in Excel 2002, but is not
supported in Excel 97.

David




Mic[_2_]

Formatting a date as a serial number
 
This will do what you want.

Selection.NumberFormat = "0"

Good Luck
Mic

-----Original Message-----
How can I return a formatted date as a serial number in
Excel 97?

FormatNumber(TheDate) works in Excel 2002, but is not
supported in Excel 97.

David

.


shockley

Formatting a date as a serial number
 
Depends what you mean by "serial number"!

My guess is you mean a date like today's: 10/28/03 returns the number
20031028, in which case you could give the cell a custom format, "yyyymmdd"
or you could use a formula like this:

=YEAR(B1)&MONTH(B1)&DAY(B1)

HTH,
Shockley

"David" wrote in message
...
How can I return a formatted date as a serial number in
Excel 97?

FormatNumber(TheDate) works in Excel 2002, but is not
supported in Excel 97.

David





All times are GMT +1. The time now is 04:27 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com