IF 语句:如果条件为假,如何将单元格留空(“"不起作用) [英] IF statement: how to leave cell blank if condition is false ("" does not work)

查看:66
本文介绍了IF 语句:如果条件为假,如何将单元格留空(“"不起作用)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想写一个 IF 语句,如果条件为 FALSE,则单元格留空.请注意,如果在 C1 中输入以下公式(条件为假),例如:

I would like to write an IF statement, where the cell is left blank if the condition is FALSE. Note that, if the following formula is entered in C1 (for which the condition is false) for example:

 =IF(A1=1,B1,"")

如果使用 =ISBLANK(C1) 测试 C1 是否为空白,这将返回 FALSE,即使 C1 似乎为空白.这意味着如果条件不满足,=IF(A1=1,B1,"") 公式在技术上不会将单元格留空.

and if C1 is tested for being blank or not using =ISBLANK(C1), this would return FALSE, even if C1 seems to be blank. This means that the =IF(A1=1,B1,"") formula does not technically leave the cells blank if the condition is not met.

关于实现这一目标的方法有什么想法吗?谢谢,

Any thoughts as to a way of achieving that? Thanks,

推荐答案

试试这个

=IF(ISBLANK(C1),TRUE,(TRIM(C1)=""))

对于真正为空白或只包含空格的单元格,这将返回 true.

This will return true for cells that are either truly blank, or contain nothing but white space.

有关其他一些选项,请参阅此帖子.

See this post for a few other options.

编辑

要反映评论和您最终做了什么:不要评估为",而是输入另一个值,例如deleteme",然后搜索deleteme"而不是空格.

To reflect the comments and what you ended up doing: Instead of evaluating to "" enter another value such as 'deleteme' and then search for 'deleteme' instead of blanks.

=IF(ISBLANK(C1),TRUE,(TRIM(C1)="deleteme"))

这篇关于IF 语句:如果条件为假,如何将单元格留空(“"不起作用)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆