Is there a If Between function in Access
Posted on 2007-11-29
Is there a If Between function in Access?
I would like to compare a date field with today's date, and put the result into a group based on the number that the comparison returns. I'm not sure exactly how it would look. I would like to do it in Access, but I will settle for Excel too. In example:
If Date() - [DateField] is =< 44 & => 1 then output (Group 1)
If Date() - [DateField] is =< 90 & => 45 then output (Group 2)
I know I could use a bunch of (AND) or (OR) statements, but I'm hoping that the is a better way to do it; simular to the way you can use conditional formatting in Excel.
Something like IFBetween(Date()-[DateField], 45, 90)
I already know how to do it this way:
DateGroup: IIF(Date()-[DateField] =< 90 AND Date()-[DateField] => 45, "Group 2", IIF( etc...
Thanks in advance for your help, Jon
p.s. I will double the points if you can tell me how to do it in both Access and Excel.