PC Review


Reply
Thread Tools Rate Thread

Date formula to return two digit year

 
 
XP
Guest
Posts: n/a
 
      10th Jul 2008
I'm trying to perfect a formula that produces a two digit year from another
cell that contains a full date, for example:

Y12 contains the following formatted as a date: 07-10-2008

In Y13 my formula is: =TEXT(YEAR(Y12),"##")

No matter what I try I get: 2008 as a result rather than the intended: 08

I'm sure it is obvious, but can someone please assist. Thanks much in advance!
 
Reply With Quote
 
 
 
 
Dennis
Guest
Posts: n/a
 
      10th Jul 2008
=TEXT(Y12,"yy")

"XP" wrote:

> I'm trying to perfect a formula that produces a two digit year from another
> cell that contains a full date, for example:
>
> Y12 contains the following formatted as a date: 07-10-2008
>
> In Y13 my formula is: =TEXT(YEAR(Y12),"##")
>
> No matter what I try I get: 2008 as a result rather than the intended: 08
>
> I'm sure it is obvious, but can someone please assist. Thanks much in advance!

 
Reply With Quote
 
Dave Peterson
Guest
Posts: n/a
 
      10th Jul 2008
=TEXT(YEAR(Y12),"YY")



XP wrote:
>
> I'm trying to perfect a formula that produces a two digit year from another
> cell that contains a full date, for example:
>
> Y12 contains the following formatted as a date: 07-10-2008
>
> In Y13 my formula is: =TEXT(YEAR(Y12),"##")
>
> No matter what I try I get: 2008 as a result rather than the intended: 08
>
> I'm sure it is obvious, but can someone please assist. Thanks much in advance!


--

Dave Peterson
 
Reply With Quote
 
PCLIVE
Guest
Posts: n/a
 
      10th Jul 2008
Maybe this:

=TEXT(Y13,"yy")

HTH,
Paul

--

"XP" <(E-Mail Removed)> wrote in message
news:FF59EDE9-E5A3-4745-8474-(E-Mail Removed)...
> I'm trying to perfect a formula that produces a two digit year from
> another
> cell that contains a full date, for example:
>
> Y12 contains the following formatted as a date: 07-10-2008
>
> In Y13 my formula is: =TEXT(YEAR(Y12),"##")
>
> No matter what I try I get: 2008 as a result rather than the intended: 08
>
> I'm sure it is obvious, but can someone please assist. Thanks much in
> advance!



 
Reply With Quote
 
Gord Dibben
Guest
Posts: n/a
 
      10th Jul 2008
Would =TEXT(Y12,"yy") work for you?


Gord Dibben MS Excel MVP


On Thu, 10 Jul 2008 08:11:03 -0700, XP <(E-Mail Removed)> wrote:

>I'm trying to perfect a formula that produces a two digit year from another
>cell that contains a full date, for example:
>
>Y12 contains the following formatted as a date: 07-10-2008
>
>In Y13 my formula is: =TEXT(YEAR(Y12),"##")
>
>No matter what I try I get: 2008 as a result rather than the intended: 08
>
>I'm sure it is obvious, but can someone please assist. Thanks much in advance!


 
Reply With Quote
 
Dave Peterson
Guest
Posts: n/a
 
      10th Jul 2008
Ignore this response.

I didn't notice the year() portion.

Dave Peterson wrote:
>
> =TEXT(YEAR(Y12),"YY")
>
> XP wrote:
> >
> > I'm trying to perfect a formula that produces a two digit year from another
> > cell that contains a full date, for example:
> >
> > Y12 contains the following formatted as a date: 07-10-2008
> >
> > In Y13 my formula is: =TEXT(YEAR(Y12),"##")
> >
> > No matter what I try I get: 2008 as a result rather than the intended: 08
> >
> > I'm sure it is obvious, but can someone please assist. Thanks much in advance!

>
> --
>
> Dave Peterson


--

Dave Peterson
 
Reply With Quote
 
XP
Guest
Posts: n/a
 
      10th Jul 2008
Yeah, thanks.

It was a case of my adding too much! When I remove the "Year" portion, it
works.

Thanks again.

"Gord Dibben" wrote:

> Would =TEXT(Y12,"yy") work for you?
>
>
> Gord Dibben MS Excel MVP
>
>
> On Thu, 10 Jul 2008 08:11:03 -0700, XP <(E-Mail Removed)> wrote:
>
> >I'm trying to perfect a formula that produces a two digit year from another
> >cell that contains a full date, for example:
> >
> >Y12 contains the following formatted as a date: 07-10-2008
> >
> >In Y13 my formula is: =TEXT(YEAR(Y12),"##")
> >
> >No matter what I try I get: 2008 as a result rather than the intended: 08
> >
> >I'm sure it is obvious, but can someone please assist. Thanks much in advance!

>
>

 
Reply With Quote
 
Rick Rothstein \(MVP - VB\)
Guest
Posts: n/a
 
      10th Jul 2008
You have your answer (several times now), but I just wanted to mention that
when you use a # or 0 symbol in the integer part of a string pattern, that
does *not* restrict the number of digits in the integer part of the number
being processed, it only differentiates whether leading zeroes will be
printed or not. This is different from the decimal part of a floating point
number where the number of # or 0 symbols in the string pattern does
truncate (actually, round) the number of decimal places printed out. So,
whether you used "#", "##", "###", etc. in the integer part of the pattern
string, you would always have gotten 2008 printed out. As the other
responses showed, using the date part meta-characters in the pattern string
allow you to restrict the part of the date printed out.

Rick


"XP" <(E-Mail Removed)> wrote in message
news:FF59EDE9-E5A3-4745-8474-(E-Mail Removed)...
> I'm trying to perfect a formula that produces a two digit year from
> another
> cell that contains a full date, for example:
>
> Y12 contains the following formatted as a date: 07-10-2008
>
> In Y13 my formula is: =TEXT(YEAR(Y12),"##")
>
> No matter what I try I get: 2008 as a result rather than the intended: 08
>
> I'm sure it is obvious, but can someone please assist. Thanks much in
> advance!


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Pulling a date from a two digit year and julian date Ziggs Microsoft Access 3 25th Dec 2006 07:59 PM
2 digit year in dates return 19xx not 20xx moranbo Microsoft Excel Misc 1 7th Sep 2005 01:44 AM
Result of date as Month-2 digit Year =?Utf-8?B?TGluZGE=?= Microsoft Excel Discussion 3 4th Jun 2005 04:58 PM
Date formula: return Quarter and Fiscal Year of a date =?Utf-8?B?Um9i?= Microsoft Excel Misc 7 11th May 2005 08:48 PM
2 digit year for date input mask Jade Microsoft Access Forms 2 23rd Mar 2004 08:16 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:19 PM.