[英]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.我在 A 列中有一个日期,例如:2022 年 1 月 2 日。 When 30 days have passed, I use the following formula to tell me something has expired:
30 天过去后,我使用以下公式告诉我某些内容已过期:
=AND($A2<=(TODAY()-30),$A2<>"")
The result if expired: TRUE.过期的结果:TRUE。
Sometimes, I have another value in column B. This value indicates when something has been closed and expiration should no longer apply.有时,我在 B 列中有另一个值。该值指示某些内容何时已关闭并且不再适用到期。
How can I modify the above formula to take my column B date into consideration?如何修改上述公式以考虑我的 B 列日期? so that if any value is detected in column B at all, my result will be custom text, like "N/A"?
因此,如果在 B 列中检测到任何值,我的结果将是自定义文本,例如“N/A”?
You can use IF
or IFS
combined with ISDATE
or ISBLANK
:您可以将
IF
或IFS
与ISDATE
或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") (如果 B2 是日期,则输入“N/A”,如果您的原始公式计算结果为 TRUE,则输入“Yes”,否则输入“No”)
or或者
=IFS(AND(ISBLANK(B2),$A2<=(TODAY()-30),$A2<>""),"Yes",ISBLANK(B2),"No",TRUE,"N/A")
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.