[英]Return a number and text string in Excel If statement
I am trying to create an If statement in Excel that calculates the difference between two dates (in this case "Required Submission Date" and "Actual Submission Date"), and then outputs the absolute value of this number and follows it with "Days overdue" or "Days until due" accordingly. 我试图在Excel中创建一个If语句来计算两个日期之间的差异(在这种情况下为“必需提交日期”和“实际提交日期”),然后输出此数字的绝对值,并在其后面显示“逾期天数” “或”相应的天数“。
I have attempted converting the number to a text string after the calculation: 我在计算后尝试将数字转换为文本字符串:
=IF((H11-J11)<0,TEXT(H11-J11,0)"Days overdue", TEXT(H11-TODAY(),0)"Days Until Due")
I have also attempted this: 我也试过这个:
=IF((H11-J11)<0,abs(H11-J11)"Days overdue", (abs(H11-TODAY()))"Days Until Due")
Is there any way to achieve what I am after? 有没有办法实现我的目标? ie if the submission is overdue, it should return "XX days overdue" 即如果提交过期,则应返回“XX天逾期”
Thanks 谢谢
You are almost there. 你快到了。 It should be : 它应该是 :
=IF((H11-J11)<0,abs(H11-J11) & " Days overdue",(abs(H11-TODAY())) & " Days Until Due")
In fact you are just missing the string concatenation character &
. 实际上你只是缺少字符串连接字符&
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.