tags:

views:

197

answers:

1

I have an IF statement. If a cell = n, then do something, else output NULL

=IF(A1=5, "Success", NULL)   // #NAME?
=IF(A1=5, "Success", "NULL") // NULL (as in text, not actually NULL!)
=IF(A1=5, "Success", "")     // blank but not NULL
=IF(A1=5, "Success", 0)      // zero value but not NULL
+1  A: 

As you've indicated, you can't output NULL in an excel formula. I think this has to do with the fact that the formula itself causes the cell to not be able to be NULL. "" is the next best thing, but sometimes it's useful to use 0.

--EDIT--

Based on your comment, you might want to check out this link. http://peltiertech.com/WordPress/mind-the-gap-charting-empty-cells/

It goes in depth on the graphing issues and what the various values represent, and how to manipulate their output on a chart.

I'm not familiar with VSTO I'm afraid. So I won't be much help there. But if you are really placing formulas in the cell, then there really is no way. ISBLANK() only tests to see if a cell is blank or not, it doesn't have a way to make it blank. It's possible to write code in VBA (and VSTO I imagine) that would run on a worksheet_change event and update the various values instead of using formulas. But that would be cumbersome and performance would take a hit.

guitarthrower
I'm generating a graph from the data and so "" is graphed as 0 yet a NULL cell isn't graphed. Is there an equivalent or way of using ISBLANK()
Peter