ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   date range in an if then statement (https://www.excelbanter.com/excel-discussion-misc-queries/157093-date-range-if-then-statement.html)

jimmy

date range in an if then statement
 
I have date ranges that certain things happen on. I need a formula that can
read a cell and determine if it's in betweeen August 16 and November 15, for
example, and return a value if it's true. I'm not sure how to get it to
work.

Thanks

ExcelBanter AI

Answer: date range in an if then statement
 
Here's the formatted text in BBCode:

Sure, I can help you with that!

You can use the IF function along with the AND function to check if a date falls within a specific range. Here's an example formula:

Code:

=IF(AND(A1=DATE(2021,8,16),A1<=DATE(2021,11,15)),"Value if true","Value if false")
In this formula, A1 is the cell that contains the date you want to check. The DATE function is used to create the start and end dates of the range you want to check. The AND function checks if the date in A1 is greater than or equal to August 16, 2021 AND less than or equal to November 15, 2021. If this condition is true, the formula returns "Value if true". If it's false, the formula returns "Value if false".

You can replace "Value if true" and "Value if false" with the actual values you want to return.
  1. Use the IF function along with the AND function to check if a date falls within a specific range.
  2. Replace A1 with the cell that contains the date you want to check.
  3. Use the DATE function to create the start and end dates of the range you want to check.
  4. Use the AND function to check if the date in A1 is greater than or equal to August 16, 2021 AND less than or equal to November 15, 2021.
  5. Replace "Value if true" and "Value if false" with the actual values you want to return.

Let me know if you have any questions.

Peo Sjoblom

date range in an if then statement
 
August 16 what year, please provide as much info as possible when you ask a
question, I will assume the year is 2007, if not by looking at the formula
you should be able to adjust it. Also between does that include Aug 16, Nov
15, if not replace <= and = with < and

=IF(A2="","",IF(AND(A2=DATE(2007,8,16),A2<=DATE(2 007,11,15)),"Between","Not
between"))


--
Regards,

Peo Sjoblom




"Jimmy" wrote in message
...
I have date ranges that certain things happen on. I need a formula that
can
read a cell and determine if it's in betweeen August 16 and November 15,
for
example, and return a value if it's true. I'm not sure how to get it to
work.

Thanks




Jim Thomlinson

date range in an if then statement
 
Assuming your date is in cell A1 this formula will return true or false...

=AND(A1=DATE(2007,8,16),A1<=DATE(2007,11,15))
--
HTH...

Jim Thomlinson


"Jimmy" wrote:

I have date ranges that certain things happen on. I need a formula that can
read a cell and determine if it's in betweeen August 16 and November 15, for
example, and return a value if it's true. I'm not sure how to get it to
work.

Thanks


Kevin B

date range in an if then statement
 
Try something like the following:

=IF(AND(B2=DATE(2007,8,16),B2<=DATE(2007,11,16)), TRUE,FALSE)

The formula compares the value in cell B2 to see if it falls between the 2
dates specified. The syntax for DATE is DATE(year,month,day) and the AND
function lets you state the date range.

--
Kevin Backmann


"Jimmy" wrote:

I have date ranges that certain things happen on. I need a formula that can
read a cell and determine if it's in betweeen August 16 and November 15, for
example, and return a value if it's true. I'm not sure how to get it to
work.

Thanks


jimmy

date range in an if then statement
 
Thanks for all the help!!

"Peo Sjoblom" wrote:

August 16 what year, please provide as much info as possible when you ask a
question, I will assume the year is 2007, if not by looking at the formula
you should be able to adjust it. Also between does that include Aug 16, Nov
15, if not replace <= and = with < and

=IF(A2="","",IF(AND(A2=DATE(2007,8,16),A2<=DATE(2 007,11,15)),"Between","Not
between"))


--
Regards,

Peo Sjoblom




"Jimmy" wrote in message
...
I have date ranges that certain things happen on. I need a formula that
can
read a cell and determine if it's in betweeen August 16 and November 15,
for
example, and return a value if it's true. I'm not sure how to get it to
work.

Thanks






All times are GMT +1. The time now is 12:26 PM.

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