#  Other Applications & Softwares  > Access Tables & Databases >  >  How to write a IIF function with greater & less than in query?

## jgomez

Hello I have a query that pulls past due days for customers... I created my own PD interval with the little formula below. I'd like to change it to be anything less than 15 days then 15 days between 30 and so on and so forth... i just don't know how to change the formula. Any help will be appreciated!


PD Interval: IIf([PAST_DUE_DAYS]<31,"3-30",IIf([PAST_DUE_DAYS]<61,"31-60",IIf([PAST_DUE_DAYS]<91,"61-90",IIf([PAST_DUE_DAYS]<121,"91-120","121+"))))

----------


## Leizure

Try:

IIf([PAST_DUE_DAYS]<15,"3-30",IIf([PAST_DUE_DAYS]>=15 AND [PAST_DUE_DAYS] <30,"31-60", ...

----------


## jgomez

Thank you! This did it.

----------

