ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Using the If function for a date range (https://www.excelbanter.com/excel-discussion-misc-queries/448088-using-if-function-date-range.html)

Jon Keym

Using the If function for a date range
 
Hi,
I was wondering if anyone could please help me.

I'm trying to set up a formular that says if A1 (which is a date) is between 01/01/2012-31/12/12 then B1 will say "2012".
If A1 is between 01/01/2013-31/12/2013 then B1 will say "2013" and so on.

Can anyone suggest the best way of doing this?

Thanks,

Jon.

Claus Busch

Using the If function for a date range
 
Hi Jon,

Am Wed, 30 Jan 2013 12:04:20 +0000 schrieb Jon Keym:

I'm trying to set up a formular that says if A1 (which is a date) is
between 01/01/2012-31/12/12 then B1 will say "2012".
If A1 is between 01/01/2013-31/12/2013 then B1 will say "2013" and so
on.


in B1 try:
=YEAR(A1)


Regards
Claus Busch
--
Win XP PRof SP2 / Vista Ultimate SP2
Office 2003 SP2 /2007 Ultimate SP2

Kevin@Radstock

Hi Jon Keym

If the date in A1 is a proper date & not text. Then the following formula in B1 should suit your requirement.

=YEAR(A1)

Quote:

Originally Posted by Jon Keym (Post 1609000)
Hi,
I was wondering if anyone could please help me.

I'm trying to set up a formular that says if A1 (which is a date) is between 01/01/2012-31/12/12 then B1 will say "2012".
If A1 is between 01/01/2013-31/12/2013 then B1 will say "2013" and so on.

Can anyone suggest the best way of doing this?

Thanks,

Jon.


Jon Keym

Quote:

Originally Posted by Kevin@Radstock (Post 1609005)
Hi Jon Keym

If the date in A1 is a proper date & not text. Then the following formula in B1 should suit your requirement.

=YEAR(A1)

Works perfectly. Thanks very much.

johnhy

Quote:

Originally Posted by Jon Keym (Post 1609006)
Works perfectly. Thanks very much.

in future you can also refer to www.excelformulaslist.com which has explanation and examples for tons excel formulas


All times are GMT +1. The time now is 06:40 PM.

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