"Hide" if zero

Posted on 2015-02-19
Last Modified: 2015-03-06

Is possible with Numeric Format Strings not show a value field if zero. For ex. i have some values like "0,00" in a report and i need to supress, print blank.

best regards
Question by:rflorencio
LVL 68

Expert Comment

ID: 40618374
No, you need to implement that yourself by checking the value against zero and replacing with blank.
LVL 49

Expert Comment

ID: 40618380

pls try in excel

yourRange.NumberFormat  = "0.00;-0,00;";

if you want to use string format then use

double posValue = 1234;
double negValue = -1234;
double zeroValue = 0;

string fmt2 = "##;(##)";
string fmt3 = "##;(##);**Zero**";

Console.WriteLine(String.Format("{0:" + fmt2 + "}", posValue));    
// Displays 1234

Console.WriteLine(String.Format("{0:" + fmt2 + "}", negValue));    
// Displays (1234)

Console.WriteLine(String.Format("{0:" + fmt3 + "}", zeroValue));
// Displays **Zero**

Open in new window

refer to

LVL 16

Accepted Solution

Imran Javed Zia earned 500 total points
ID: 40618385

you can use following:

d = 0.0;

It will show blank space

d = 1.20;
It will show 1.2


Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
detecting  the added row index in a datagridview 3 62 checkbox 7 41
Reset login password 4 34
VB.NET 2008 Populate DataModel with DataTable 44 13
Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now