ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Referencing year portion of date (https://www.excelbanter.com/excel-programming/419630-referencing-year-portion-date.html)

Allison

Referencing year portion of date
 
Excel 2003 SP2
Win XP SP3

I want to compare today's year with a 4-digit number to see if they are the
same.

I tried formatting a cell as "yyyy" and then using =now(). This DISPLAYS
the year, but if I try to compare it to the number I get a mismatch.

Ultimately, I want to display "Updated" in a cell, if today's year is the
same as the 4-digit number in the reference sheet.

I'd prefer a formula over VBA code, but beggars can't be choosers, right? =)

I'd appreciate any pointers to get me started in the right direction. Thank
you.

Dave Peterson

Referencing year portion of date
 
=if(year(today()=a1,"same year","different years")



Allison wrote:

Excel 2003 SP2
Win XP SP3

I want to compare today's year with a 4-digit number to see if they are the
same.

I tried formatting a cell as "yyyy" and then using =now(). This DISPLAYS
the year, but if I try to compare it to the number I get a mismatch.

Ultimately, I want to display "Updated" in a cell, if today's year is the
same as the 4-digit number in the reference sheet.

I'd prefer a formula over VBA code, but beggars can't be choosers, right? =)

I'd appreciate any pointers to get me started in the right direction. Thank
you.


--

Dave Peterson

ArthurJ

Referencing year portion of date
 
A B
1 3/1/2005 =year(A1)=A$5 False
2 10/5/2008 True
3 4/9/2003 False
4
5 2008

Enter the formula shown in cell B1 and copied it down.
It will evaluate as shown.

Art

Allison

Referencing year portion of date
 
Exactly what I wanted. Thank you.

"Dave Peterson" wrote:

=if(year(today()=a1,"same year","different years")



Allison wrote:

Excel 2003 SP2
Win XP SP3

I want to compare today's year with a 4-digit number to see if they are the
same.

I tried formatting a cell as "yyyy" and then using =now(). This DISPLAYS
the year, but if I try to compare it to the number I get a mismatch.

Ultimately, I want to display "Updated" in a cell, if today's year is the
same as the 4-digit number in the reference sheet.

I'd prefer a formula over VBA code, but beggars can't be choosers, right? =)

I'd appreciate any pointers to get me started in the right direction. Thank
you.


--

Dave Peterson


Allison

Referencing year portion of date
 
Thank you.

"ArthurJ" wrote:

A B
1 3/1/2005 =year(A1)=A$5 False
2 10/5/2008 True
3 4/9/2003 False
4
5 2008

Enter the formula shown in cell B1 and copied it down.
It will evaluate as shown.

Art



All times are GMT +1. The time now is 12:39 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com