从Excel中的公式返回空单元格

从Excel中的公式返回空单元格

本文介绍了从Excel中的公式返回空单元格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要从Excel公式返回一个空单元格,但Excel似乎与一个真正的空单元格不同,它处理一个空字符串或对一个空单元格的引用。所以本质上我需要像

I need to return an empty cell from an Excel formula, but it appears that Excel treats an empty string or a reference to an empty cell differently than a true empty cell. So essentially I need something like

=IF(some_condition,EMPTY(),some_value)

我试图做一些事情,如

=IF(some_condition,"",some_value)

=IF(some_condition,,some_value)

并假设B1是一个空单元格

and assuming B1 is an empty cell

=IF(some_condition,B1,some_value)

但这些都不是真的空单元格,我猜是因为它们是公式的结果。是否有任何方式填充单元格,如果且仅当满足某些条件,否则保持单元格真空?

but none of these appear to be true empty cells, I'm guessing because they are the result of a formula. Is there any way to populate a cell if and only if some condition is met and otherwise keep the cell truly empty?

编辑:按照建议,我尝试返回NA ),但为了我的目的,这也没有。有没有办法使用VB?

as recommended, I tried to return NA(), but for my purposes this did not work either. Is there a way to do this with VB?

编辑:我正在构建一个工作表,从其他工作表中提取数据,这些工作表被格式化为应用程序的特定要求将数据导入数据库。我没有权限更改此应用程序的实现,如果值为,而不是实际为空,则它将失败。

I am building a worksheet that pulls in data from other worksheets that is formatted to the very specific demands of an application that imports the data into a database. I do not have access to change the implementation of this application, and it fails if the value is "" instead of actually empty.

推荐答案

p>然后,您将不得不使用 VBA 。您将遍历范围中的单元格,测试条件,如果匹配,则删除内容。

You're going to have to use VBA, then. You'll iterate over the cells in your range, test the condition, and delete the contents if they match.

类似于:

For Each cell in SomeRange
  If (cell.value = SomeTest) Then cell.ClearContents
Next

这篇关于从Excel中的公式返回空单元格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-26 04:06