Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22,906
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Disabling Function Results in the Function Arguments Window [email protected] Excel Programming 1 September 24th 08 06:12 AM
how do you write format results of a function within a function? sangee Excel Worksheet Functions 3 June 14th 07 12:45 AM
Formatting Formula Results Rob Excel Programming 1 September 4th 06 07:27 PM
Formatting Formula Results Rob Excel Programming 0 September 2nd 06 09:14 PM
Formatting the Results of VLOOKUP LPS Excel Worksheet Functions 1 February 11th 05 02:15 PM


All times are GMT +1. The time now is 03:42 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"