if statement

M

matt wolfe chazin

i want to know the syntax for an if statement

i want the if statment to generate a "1", if the dates fall within the range
07/01/2002 - 06/30/2003 , if not, then "0"

thanks
 
P

Paul

matt wolfe chazin said:
i want to know the syntax for an if statement

i want the if statment to generate a "1", if the dates fall within the range
07/01/2002 - 06/30/2003 , if not, then "0"

thanks

For a date in A1, try
=IF(AND(A1>DATE(2002,7,1),A1<DATE(2003,6,30)),1,0)

Use >= and <= (instead of > and <) if you want to include the given dates in
your range.
 
P

Peo Sjoblom

Another way somewhat shorter but less pedagogical

=(A1>="07/01/02"+0)*(A1<="06/30/03"+0)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top