An excel formula using IS BLANK and IS NOT BLANK based on two columns

落爺英雄遲暮 提交于 2019-12-14 03:23:40

问题


I need to calc the time between two dates. If column V is blank, then look at column X; now return the difference btw the returned value (either X or V) and the date in column S.


回答1:


Maybe

=IF(ISBLANK(V2),S2-X2,S2-V2)

In words: If cell V2 is blank, calculate S2 minus X2, otherwise calculate S2 minus V2.

Adjust to your needs.




回答2:


For row 1, you could use

=IF(OR(ISBLANK(V1),V1=""),X1-S1,V1-S1)

It is extremely important to note that blank and an empty string behave differently. This shows up once and again, and it is a source of quite a bit of trouble. Any formula or code should account for this, according to the demands of the task.

In addition, you have to select an appropriate number format. For instance, use Custom, and in Type use dd"d" hh:mm.



来源:https://stackoverflow.com/questions/27663891/an-excel-formula-using-is-blank-and-is-not-blank-based-on-two-columns

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!