[Solved] Display a currency symbol if a cell is zero or...

Discuss the spreadsheet application
Post Reply
jdagen5
Posts: 3
Joined: Tue Aug 18, 2015 9:20 pm

[Solved] Display a currency symbol if a cell is zero or...

Post by jdagen5 »

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.
Last edited by jdagen5 on Thu Aug 20, 2015 9:13 pm, edited 2 times in total.
OpenOffice 3.3.0 on Windows 7
User avatar
karolus
Volunteer
Posts: 1160
Joined: Sat Jul 02, 2011 9:47 am

Re: Displaying a currency symbol if a cell is zero or blank

Post by karolus »

Set Formatcode like

Code: Select all

[$$-409]#,##0.00;[RED]-[$$-409]#,##0.00;[$$-409]0.00;"$"
and prefill the Cells with Formula

Code: Select all

=""
btw. if you enter a space into a cell, the cell is not blanc anymore.
AOO4, Libreoffice 6.1 on Rasbian OS (on ARM)
Libreoffice 7.4 on Debian 12 (Bookworm) (on RaspberryPI4)
Libreoffice 7.6 flatpak on Debian 12 (Bookworm) (on RaspberryPI4)
jdagen5
Posts: 3
Joined: Tue Aug 18, 2015 9:20 pm

Re: Displaying a currency symbol if a cell is zero or blank

Post by jdagen5 »

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
User avatar
karolus
Volunteer
Posts: 1160
Joined: Sat Jul 02, 2011 9:47 am

Re: Displaying a currency symbol if a cell is zero or blank

Post by karolus »

Hallo
Is there a way to apply that style to a blank cell as well?
No, you have to apply also an empty String →see the Formula in the post above.

Karolus
AOO4, Libreoffice 6.1 on Rasbian OS (on ARM)
Libreoffice 7.4 on Debian 12 (Bookworm) (on RaspberryPI4)
Libreoffice 7.6 flatpak on Debian 12 (Bookworm) (on RaspberryPI4)
User avatar
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

Post by MrProgrammer »

Hi, and welcome to the forum.
jdagen5 wrote:Is there a way to apply that style to a blank cell as well?
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.

[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).
jdagen5
Posts: 3
Joined: Tue Aug 18, 2015 9:20 pm

Re: Displaying a currency symbol if a cell is zero or blank

Post by jdagen5 »

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.
OpenOffice 3.3.0 on Windows 7
Post Reply