custom format for cells with nothing in them without using conditional formatting

2

1

if a cell is blank I would like to add text using a custom format. I've seen where text is added if a value is above or below a certain value. Can you add text to the cell if the cell is blank? I've tried the following with no luck

[=0]"Enter value"* 0;

[=""]"Enter value"* 0;

guitarthrower

Posted 2009-10-21T05:07:08.363

Reputation: 933

Answers

7

Well, it can be done, and it can't. You can make it look like the format you require, as in the picture below. Cell C3 and Cell C5 are formatted identically, with a value in C5:

alt text

When you enter the text into the cell, in this case C5 the text disappears. The secret is in the one pixel column, Column B. B3 contains "Enter value" and is formatted red, bold. It's a cheat, but I have used it to good effect.

user17170

Posted 2009-10-21T05:07:08.363

Reputation: 94

1That's really clever. Excellent workaround. – guitarthrower – 2009-11-07T23:05:24.133

4

Select your cells and go to the number format dialog box and select Custom from the list on the left. Then in the Type text box, enter:

#,##0.00;-#,##0.00;"Enter value"

The entry before the first semi-colon specifies the format for positive numbers, the entry between the first and second semi-colons specifies the format for negative numbers. Change these to the correct format for your own data. The third entry specifies the format for zero.

If you format your cells this way and type 0 into the cell, the cell will CONTAIN zero, but will display whatever text you specify.

This will only work if the cell contains 0. I could not think of any way to do this for a text entry without some kind of "helper" function in another cell as jmaglasang suggests, or without some VBA code on the Worksheet_Change event.

If you would like a VBA solution, let me know. However, this means that users would have to have macros enabled for that to work.

dendarii

Posted 2009-10-21T05:07:08.363

Reputation: 141

I suspected that it wasn't possible without some VBA trickery. Thanks for the explanation on the formatting. I've never really understood how that worked. – guitarthrower – 2009-10-21T20:11:14.590

I should add, that I'm trying to keep VBA out of it to ease use and distribution. – guitarthrower – 2009-10-21T20:11:46.540

3True, VBA does complicate things in some environments. FYI there's a fourth possible section on custom number formats which specifies what to display if the cell contains text. However, I've never used that fourth option. – dendarii – 2009-10-22T08:19:05.083

0

Just to add to the answer provided by @dendarii -- you can add a fourth, for text. For example, with this number formatting:

"My Positive Number";"My Negative Number";"My Zero";"My Text"

...the cell will display "My Text" if any non-numeric text is entered.

However, unfortunately there isn't a fifth option for blank cell.

So if your scenario allows having, say, a space character in the cell by default, then you could do it with that fourth option. But if the user deletes that space character from the cell, leaving it blank, your custom display text goes away.

Greg Lovern

Posted 2009-10-21T05:07:08.363

Reputation: 136

-1

enter image description here

If I have understood this you can try:

IF(condition,TrueValue,FalseValue)

Empty value are considered false when being evaluated.

jerjer

Posted 2009-10-21T05:07:08.363

Reputation:

thanks, but I would want the text to appear without any formulas in the column B that you have in your image. – guitarthrower – 2009-10-21T06:15:32.313