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

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

问题描述

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

  = IF(A1 = 1,B1,)

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

$ b对于实现这一点的方式,有什么想法吗?谢谢,

解决方案

尝试这样做

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

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



请参阅这个 post 等几个选项。



em>



为了反映评论和你最后的做法:而不是评估输入另一个值,如deleteme,然后搜索'deleteme'而不是空格。

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


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,"")

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,

解决方案

Try this instead

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

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.

edit

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语句:如果条件为false,则如何将单元格留空(“”不起作用)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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