Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 58
Default Year & Month format

Hi,

I have col which contains year & month. Now i want to pull the values which
is less than or equal to current month.

A
2006-08
2008-04
2007-11
2008-01
2007-11

I tried with this formula but it is not working. Can any one help me?

=IF(year(a2)&"-"&MONTH(A2)<=year(TODAY()&"-"&month(today()),MONTH(TODAY())&"-"&YEAR(TODAY()),"")


- Christ
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,646
Default Year & Month format

What is the format of cells in column A? Text or Date like "yyyy-mm"?
Stefi


€˛Christopher Naveen€¯ ezt Ć*rta:

Hi,

I have col which contains year & month. Now i want to pull the values which
is less than or equal to current month.

A
2006-08
2008-04
2007-11
2008-01
2007-11

I tried with this formula but it is not working. Can any one help me?

=IF(year(a2)&"-"&MONTH(A2)<=year(TODAY()&"-"&month(today()),MONTH(TODAY())&"-"&YEAR(TODAY()),"")


- Christ

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 8,651
Default Year & Month format

=IF(A2<=TEXT(TODAY(),"yyyy-mm"),A2,"") if the column A entries are text.

=IF(TEXT(A2,"yyyy-mm")<=TEXT(TODAY(),"yyyy-mm"),A2,"") if column A entries
are dates formatted that way (and it would still work with text in A). If
you do have dates in A, you'd presumably want to format your result cells to
show the date the same way.

It isn't entrirely clear what you want as your output. From your
description I assumed that you wanted to see the column A values carried
forward if they met your criteria, but from your attempted formula it looks
as if you might want today's date formatted in a different way. If need be
you can replace the A2 in the output by whatever you do want, either a date
which you can format in the cell or a text output.

With your formula, you need to think carefully about the syntax for each
function you are using, and make sure that the right parameters fall in the
right places compared with your parentheses and the commas. For example,
your second YEAR function is trying to work on a text string, whereas you
probably wanted it to work on a date TODAY(). At first glance it doesn't
even look as if you've got the same number of opening and closing
parentheses in the equation.
--
David Biddulph

"Christopher Naveen" wrote in
message ...
Hi,

I have col which contains year & month. Now i want to pull the values
which
is less than or equal to current month.

A
2006-08
2008-04
2007-11
2008-01
2007-11

I tried with this formula but it is not working. Can any one help me?

=IF(year(a2)&"-"&MONTH(A2)<=year(TODAY()&"-"&month(today()),MONTH(TODAY())&"-"&YEAR(TODAY()),"")


- Christ



  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 58
Default Year & Month format

Hi David,

Thank u very much!!!!!!. Yes it is working now.

-Christ

"David Biddulph" wrote:

=IF(A2<=TEXT(TODAY(),"yyyy-mm"),A2,"") if the column A entries are text.

=IF(TEXT(A2,"yyyy-mm")<=TEXT(TODAY(),"yyyy-mm"),A2,"") if column A entries
are dates formatted that way (and it would still work with text in A). If
you do have dates in A, you'd presumably want to format your result cells to
show the date the same way.

It isn't entrirely clear what you want as your output. From your
description I assumed that you wanted to see the column A values carried
forward if they met your criteria, but from your attempted formula it looks
as if you might want today's date formatted in a different way. If need be
you can replace the A2 in the output by whatever you do want, either a date
which you can format in the cell or a text output.

With your formula, you need to think carefully about the syntax for each
function you are using, and make sure that the right parameters fall in the
right places compared with your parentheses and the commas. For example,
your second YEAR function is trying to work on a text string, whereas you
probably wanted it to work on a date TODAY(). At first glance it doesn't
even look as if you've got the same number of opening and closing
parentheses in the equation.
--
David Biddulph

"Christopher Naveen" wrote in
message ...
Hi,

I have col which contains year & month. Now i want to pull the values
which
is less than or equal to current month.

A
2006-08
2008-04
2007-11
2008-01
2007-11

I tried with this formula but it is not working. Can any one help me?

=IF(year(a2)&"-"&MONTH(A2)<=year(TODAY()&"-"&month(today()),MONTH(TODAY())&"-"&YEAR(TODAY()),"")


- Christ




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
How do I set up and use Month day, year format with other appl? [email protected] Excel Discussion (Misc queries) 2 June 26th 06 10:51 PM
I need date format to be set up as month/year. Aaron New Users to Excel 2 December 22nd 05 01:46 PM
day/month/year in incorrect format for date format M&A_Jack Excel Worksheet Functions 2 August 16th 05 08:15 PM
month & year format in two digits Morphyus C via OfficeKB.com Excel Discussion (Misc queries) 1 August 5th 05 06:22 PM
Month Year Date Format Jamie Excel Worksheet Functions 2 February 7th 05 06:43 PM


All times are GMT +1. The time now is 08:28 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"