Home |
Search |
Today's Posts |
|
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Formatting Day() Function results
I am using the day() function to create an invoice number based on the date
of the invoice. My problem is that the results of the day() function for the first 9 days of any month only generates a one digit number. How can I format the results so that day(2009/1/4) results in a 2-digit number, 04, instead of 4? Appreciate any help. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Formatting Day() Function results
FormatCellsNumberCustom
Custom Format of 00 Gord Dibben MS Excel MVP On Sat, 19 Sep 2009 18:56:01 -0700, Loyd wrote: I am using the day() function to create an invoice number based on the date of the invoice. My problem is that the results of the day() function for the first 9 days of any month only generates a one digit number. How can I format the results so that day(2009/1/4) results in a 2-digit number, 04, instead of 4? Appreciate any help. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Formatting Day() Function results
Where do you need this two-digit day number at? If in a worksheet cell, then
Gord has given you your answer. If, on the other hand, you need this within your VB code (you posted to the programming newsgroup, so I'm assuming you are writing VB code), then Dim the receiving variable as a String (numeric variables cannot hold formatting)... Dim DayNum As String and then assign the two-digit day number to it like this... DayNum = Format(YourDate, "dd") where YourDate is a valid date value. -- Rick (MVP - Excel) "Loyd" wrote in message ... I am using the day() function to create an invoice number based on the date of the invoice. My problem is that the results of the day() function for the first 9 days of any month only generates a one digit number. How can I format the results so that day(2009/1/4) results in a 2-digit number, 04, instead of 4? Appreciate any help. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Disabling Function Results in the Function Arguments Window | Excel Programming | |||
how do you write format results of a function within a function? | Excel Worksheet Functions | |||
Formatting Formula Results | Excel Programming | |||
Formatting Formula Results | Excel Programming | |||
Formatting the Results of VLOOKUP | Excel Worksheet Functions |