简体   繁体   中英

How to consider two dates in Google Sheets, in separate columns, and when a 2nd date is detected at all, yield custom text?

I have a date in column A, for example: 1/2/2022. When 30 days have passed, I use the following formula to tell me something has expired:

=AND($A2<=(TODAY()-30),$A2<>"")

The result if expired: TRUE.

Sometimes, I have another value in column B. This value indicates when something has been closed and expiration should no longer apply.

How can I modify the above formula to take my column B date into consideration? so that if any value is detected in column B at all, my result will be custom text, like "N/A"?

You can use IF or IFS combined with ISDATE or ISBLANK :

=IFS(ISDATE(B2),"N/A",AND($A2<=(TODAY()-30),$A2<>""),"Yes",TRUE,"No")

(put "N/A" if B2 is a date, "Yes" if your original formula evaluates to TRUE, otherwise "No")

or

=IFS(AND(ISBLANK(B2),$A2<=(TODAY()-30),$A2<>""),"Yes",ISBLANK(B2),"No",TRUE,"N/A")

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM