简体   繁体   English

如何在谷歌表格中考虑两个日期,在不同的列中,当检测到第二个日期时,产生自定义文本?

[英]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 :您可以将IFIFSISDATEISBLANK结合使用:

=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.

相关问题 如何在Google表格中的两列中添加日期戳记 - How to date stamp a change in two columns in google sheets 尝试使用谷歌脚本编辑器在谷歌表格中获取日期格式以显示为具有相关后缀的第一、第二、第三等 - Trying to get date format in Google Sheets to display as 1st, 2nd, 3rd etc with the relevant suffix using google scripts editor 如果第一个数组在谷歌表格中有溢出错误,如何在同一列中移动第二个数组公式? - How to move 2nd array formula in the same column if the 1st array has a spill error in google sheets? 如何使用 App Script/JavaScript 访问 Google 表格上的第二个选项卡? - How to access 2nd tab on Google Sheets using App Script/JavaScript? 将 Google 表格标签的几列下载到单独的文本文件中的脚本 - Script to download several columns of a Google Sheets Tab into separate text files Google表格:如何根据文本和日期在表格之间移动数据 - Google Sheets: How to Move Data Between Sheets based on Text and Date 如何在谷歌表格中运行两个单独的函数 - How do I run two separate functions in google sheets 如何在自定义 HTML 对话框中输入日期文本以加载 Google 表格中的值? - How to get date text input in custom HTML dialogue box to load with a value from Google Sheets? 修改代码 - 查找单元格中数据的第二个最后一个字母。 Google Apps 脚本/Google 表格 - Modify Code - lookup 2nd Last letter of data in a cell. Google Apps Script / Google Sheets 在自定义 Google Sheets 日历中对日期进行排序 - Sorting Dates in Custom Google Sheets Calendar
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM