Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default days and months with heading zero from formula

Hi all

I'm using this little formula to create a string that I use to do some
further computations

=YEAR(C88)&"-"&MONTH(C88)&"-"&DAY(C88)

the formula extracts the year,month,day from a date format cell like C88

that is MM/DD/YYYY

The problem is that if either the month or day are <10 I do not get the
heading zero from the formula.

example: C88=01/02/2003 ; my formula gives me a string 2003-2-1 instead
of 2003-02-01, which is what I need.

Is there any way to add the zero or extract the month and day so that
they keep the heading zero?

thanks

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default days and months with heading zero from formula

Please try

=TEXT(C88,"YYYY-MM-DD")

If this post helps click Yes
---------------
Jacob Skaria


"abc" wrote:

Hi all

I'm using this little formula to create a string that I use to do some
further computations

=YEAR(C88)&"-"&MONTH(C88)&"-"&DAY(C88)

the formula extracts the year,month,day from a date format cell like C88

that is MM/DD/YYYY

The problem is that if either the month or day are <10 I do not get the
heading zero from the formula.

example: C88=01/02/2003 ; my formula gives me a string 2003-2-1 instead
of 2003-02-01, which is what I need.

Is there any way to add the zero or extract the month and day so that
they keep the heading zero?

thanks


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default days and months with heading zero from formula

Jacob Skaria wrote:
Please try

=TEXT(C88,"YYYY-MM-DD")

If this post helps click Yes
---------------
Jacob Skaria


Yes, that worked! Thanks a lot!
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
Total days worked /20 to get actual months/days Cindy Excel Worksheet Functions 3 October 22nd 09 11:50 PM
Date formula resulting in Year, Months & days Ryan_Keys Excel Worksheet Functions 3 June 30th 08 05:04 PM
how do i convert a number of days to years, months & days? SafetyLen Excel Discussion (Misc queries) 1 August 23rd 07 01:34 AM
FORMULA FOR CALCULATING YEARS, DAYS, & MONTHS BETWEEN SEVERAL DATE Sam Excel Discussion (Misc queries) 3 June 28th 06 10:34 PM
convert Days to Years, Months, Days Klaudebou Excel Discussion (Misc queries) 3 December 29th 05 10:33 PM


All times are GMT +1. The time now is 02:56 PM.

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"