I'm trying to create a cell format for a document where people will usually be inputting dollar amounts into a series of cells. However, on some occasions there will be nothing to put in there. Through dumb luck, I've been able to get a format code working that displays a "$" character by itself when a value of zero is entered. However, I'd like to get the cell format set up so that it will also display a "$" character in blank cells (for instance, when a user has the cell highlighted, hits the space bar, and then hits enter). I'm having a difficult time working out a way to do this, if anyone can steer me in the right direction it'd be very helpful!
Hopefully my terminology isn't too inaccurate. This may be very simple, but I don't have a programming background and find the format codes rather difficult to parse.
[Solved] Display a currency symbol if a cell is zero or...
[Solved] Display a currency symbol if a cell is zero or...
Last edited by jdagen5 on Thu Aug 20, 2015 9:13 pm, edited 2 times in total.
OpenOffice 3.3.0 on Windows 7
Re: Displaying a currency symbol if a cell is zero or blank
Set Formatcode like
and prefill the Cells with Formula
btw. if you enter a space into a cell, the cell is not blanc anymore.
Code: Select all
[$$-409]#,##0.00;[RED]-[$$-409]#,##0.00;[$$-409]0.00;"$"
Code: Select all
=""
Libreoffice 7.4 on Debian 12 (Bookworm) (on RaspberryPI4)
Libreoffice 7.6 flatpak on Debian 12 (Bookworm) (on RaspberryPI4)
Re: Displaying a currency symbol if a cell is zero or blank
Interesting. So, that does what I'm looking for when there's a space or a zero present. But a cell with a space in it is treated differently from a blank cell. Is there a way to apply that style to a blank cell as well?
OpenOffice 3.3.0 on Windows 7
Re: Displaying a currency symbol if a cell is zero or blank
Hallo
Karolus
No, you have to apply also an empty String →see the Formula in the post above.Is there a way to apply that style to a blank cell as well?
Karolus
Libreoffice 7.4 on Debian 12 (Bookworm) (on RaspberryPI4)
Libreoffice 7.6 flatpak on Debian 12 (Bookworm) (on RaspberryPI4)
- MrProgrammer
- Moderator
- Posts: 4907
- Joined: Fri Jun 04, 2010 7:57 pm
- Location: Wisconsin, USA
Re: Displaying a currency symbol if a cell is zero or blank
Hi, and welcome to the forum.
[Tutorial] Ten concepts that every Calc user should know
If this answered your question please go to your first post use the Edit button and add [Solved] to the start of the title. You can select the green checkmark icon at the same time.
Most features in Calc apply only to non-empty cells. Even after using 40,000 cells, a sheet still has over one billion empty cells. It is impractical for features to work with billions of cells.jdagen5 wrote:Is there a way to apply that style to a blank cell as well?
[Tutorial] Ten concepts that every Calc user should know
If this answered your question please go to your first post use the Edit button and add [Solved] to the start of the title. You can select the green checkmark icon at the same time.
Mr. Programmer
AOO 4.1.7 Build 9800, MacOS 13.6.3, iMac Intel. The locale for any menus or Calc formulas in my posts is English (USA).
AOO 4.1.7 Build 9800, MacOS 13.6.3, iMac Intel. The locale for any menus or Calc formulas in my posts is English (USA).
Re: Displaying a currency symbol if a cell is zero or blank
Well, I don't want to automatically add the character to one billion cells. I want to add it to ten. If that's not possible with the version I have, pre-filling them with an empty string is as good of a workaround as I can probably do.
It would be nice if there were a way for me to set up the formatting so that the style would be applied even if another person using the document accidentally deleted the contents of these particular cells. This file is going to be used by a large number of people, and I thought it would be cool if the only way to alter the appearance of the empty cells would be to actually change the cell formatting options. My thought being that this would be far too involved a process for someone to do by accident, therefore going a long way in making this an idiot-proof thing.
Fortunately, I still think completely blanking the cells is still less likely than entering a space or a zero, so this should still be pretty good. As this is the best solution for the version I have, you can mark the topic solved.
Edit: just saw I'm the one who can do this. Marking it now.
It would be nice if there were a way for me to set up the formatting so that the style would be applied even if another person using the document accidentally deleted the contents of these particular cells. This file is going to be used by a large number of people, and I thought it would be cool if the only way to alter the appearance of the empty cells would be to actually change the cell formatting options. My thought being that this would be far too involved a process for someone to do by accident, therefore going a long way in making this an idiot-proof thing.
Fortunately, I still think completely blanking the cells is still less likely than entering a space or a zero, so this should still be pretty good. As this is the best solution for the version I have, you can mark the topic solved.
Edit: just saw I'm the one who can do this. Marking it now.
OpenOffice 3.3.0 on Windows 7