date functions using entered year only

Beaker

New Member
Joined
Jan 20, 2010
Messages
2
I am using excel 2007 and WinXP.
I am creating a chemical database including MSDS (material safety data sheets) which need to be no more than 5years old. I am trying to write a formula such that a year can be entered (e.g. 2007) and in the next cell will be 'yes' or 'no' depending on the answer to 'current year' -'year entered' (eg 2010-2007) using some logic.
I know how to formulate IF, THEN etc. Its just that when I enter a year it treats it like a serial number, converting 2005 to 1905. I would rather not have to enter a complete date, just the year only. (I understand the NOW() function for current date too.)

Thanks for all help.

Andrew
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
Beaker,

Excel Workbook
AB
1Current YearAnswer
22007Yes
32006No
42010Yes
52011No
6
Sheet1





The formula in cell B2 copied down:
=IF(OR(A2=2007,A2=2008,A2=2009,A2=2010),"Yes","No")
 
Upvote 0
If you enter a year and it's displayed as a date in 1905 then that's just a formatting issue (it doen't affect the value or any formula based on the value), just format the cells as general.

So presumably 2005 is OK but 2004 isn't?

If you put the year in A2 try this formula

=IF(YEAR(TODAY())-A2>5,"Too old","OK")
 
Upvote 0
Beaker,

Maybe this?

Excel Workbook
AB
1Current YearAnswer
22007Yes
32006Yes
42005No
5
Sheet1



The formula in cell B2 copied down:
=IF(A2<=YEAR(NOW())-5,"No","Yes")
 
Upvote 0
Thanks for your replies. Pairing the YEAR function with TODAY function did the trick.

Thanks again.
 
Upvote 0

Forum statistics

Threads
1,214,813
Messages
6,121,705
Members
449,048
Latest member
81jamesacct

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top