Answers:
以下Excel公式应该可以满足您的需求:
=IF(A1=B1, "YES", "NO - " & TEXT(MIN(A1,B1), "m/d/yyyy"))
这个公式说: if the values in A1 and B1 are equal, print YES in the current cell, otherwise print 'NO - ' appended with the lowest value of the 2 cells 'textualized' as a date in the format of 'm/d/yyyy'
该 MIN
函数将返回2个值(或您的情况下的日期)中的较低者作为序列化日期(即正常数字)。要将其显示为日期值,我们可以使用 TEXT
函数以我们指定的格式打印序列号作为日期(在本例中为“m / d / yyyy”)。
例:
| | A | B | C |
|1| 1/1/1970 | 1/1/1970 | YES |
|2| 1/1/1970 | 1/20/1970 | NO - 1/1/1970 |
在 C2
在这个例子中,如果我们没有 TEXT
指定的功能(刚才 MIN
)它会打印 NO - 25569
。
请务必更新公式的单元格引用(即 A1
和 B1
应该 A2
和 B2
等等)。
希望能有所帮助。