ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   IF function and date range (https://www.excelbanter.com/excel-programming/429381-if-function-date-range.html)

Hummel Guy

IF function and date range
 
I need the syntax for writing an IF function that can search a colum to see
if a date falls into a range. Ex: IF(D16= a date in jan 2009, true, false).

Thanks


Rick Rothstein

IF function and date range
 
If you are just checking for month/year inclusions, you don't need to use a
range...

=IF(AND(MONTH(D16)=1,YEAR(D16)=2009),TRUE,FALSE)

Also, if all you want from the comparison is TRUE or FALSE, you don't need
the IF statement... the first argument to the IF statement evaluates to TRUE
or FALSE (that is how the function knows which of the next two arguments to
pick, so you can just use the first argument all by itself...

=AND(MONTH(D16)=1,YEAR(D16)=2009)

--
Rick (MVP - Excel)


"Hummel Guy" wrote in message
...
I need the syntax for writing an IF function that can search a colum to see
if a date falls into a range. Ex: IF(D16= a date in jan 2009, true,
false).

Thanks



Hummel Guy

IF function and date range
 
Thank you very much to both of you. I borrowed a piece of each and made the
application work.

Much Thanks

"Gary''s Student" wrote:

=AND(D1639813,D16<39845)

--
Gary''s Student - gsnu200856



All times are GMT +1. The time now is 03:06 AM.

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