Posted By: Anonymous
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
I tried to do things such as
and assuming B1 is an empty cell
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?
EDIT: 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?
EDIT: 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.
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