473,387 Members | 1,669 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Excel: How do I Display Specific Text in a Cell if the Value is 0

I use in Excel the formula =NETWORKDAYS(A2;B2)for calculating the number of days between the dates in cells A2 and B2. The result is in Cell C2
However, I would like to display a Predifined Text in C2 if the result is zero.

I suppose The Predifined Text can be in the formula bar in a sort of If statement.
If 0 ,OK will be displayed in cell C2)
It does not matter what in the cell will be displayed if result is not zero.

I assume the cell C2 format must then be Text or General
Normally I use Number for C2.

May be, I also can or need to use an other formula?? DateDiff or something like that?? I do not know all possibilities.

Who can help me
Jan 11 '12 #1
8 1769
Rabbit
12,516 Expert Mod 8TB
Sounds like you're looking for the IF() function
Jan 11 '12 #2
Mariostg
332 100+
Expand|Select|Wrap|Line Numbers
  1. =if(NETWORKDAYS(A2;B2)=0,"OK",NETWORKDAYS(A2;B2))
Jan 11 '12 #3
NeoPa
32,556 Expert Mod 16PB
This can be done as a simple Format property. Something like :
Expand|Select|Wrap|Line Numbers
  1. 0;-0;"Some text"
The format property can be found in the Properties window of cells, rows and/or columns, etc.

PS. @Mario. There is no worksheet function IIF() in Excel. IF() has the same use as IIf() does in VBA though.
Jan 11 '12 #4
Mariostg
332 100+
@NeoPa. I am doing to much VBA, I have to go back to spreadsheets. I would have never thought of your answer. Love it.
Jan 11 '12 #5
NeoPa
32,556 Expert Mod 16PB
Thanks Mario. I always appreciate the support of you guys who do so much to keep things going here :-)

NB. It's important to understand that the underlying data doesn't change. It's still a zero. All that changes is what is displayed (IE. The .Text property as opposed to the .Value).
Jan 11 '12 #6
I have tried this, but I can not get it working.
I noted that thereis an IF statement

IF(logical_test[value_if_tue];[value_if_false])

But I do not know how to use this for my problem
Jan 11 '12 #7
brentg
9
see Mariostg reply and enter :
Expand|Select|Wrap|Line Numbers
  1. =IF(NETWORKDAYS(A2;B2)=0,"OK",NETWORKDAYS(A2;B2)
in cell C2. It should work. Then just copy the formula down the column.
Jan 11 '12 #8
NeoPa
32,556 Expert Mod 16PB
Peter Dam:
I have tried this, but I can not get it working.
You've tried what? In the circumstances (the thread to date) this makes little sense.

NB. Please read all the replies. You could save wasting much of your time (and ours of course).
Jan 11 '12 #9

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Amanda H | last post by:
I am trying to edit a long text cell in Enterprise Manager but when I select "<long text>" and try to delete it, I get an error saying "cannot edit this cell". Could anyone tell me how to edit...
1
by: Terry | last post by:
I have a form which displays data from both the Student Details table and the Exam Details table. The Name (Text Box) control is from the Student Details table and the Withdrawn (Check Box)...
1
by: Claudio Biagioli | last post by:
I have to replace a full HTML block (in this case a <TR>) which must contain specific word(s). Example <tr> <td>.... HELLO ....</td> </tr> must be substituted by another fixed string, but all...
1
by: hazz | last post by:
I am simply trying to obtain the value of a specific cell ( a CustomerID in a particular row.) in a DataGridView. How (or can I ) do this using the RowEnter event? The datagrid is bound to a...
1
by: Don Croner | last post by:
I am using access 2003 with windows xp. I have created a data base for to keep track of my 180 employees. I have created a table with 21 records. Then I created a form to input employee data. I...
1
by: dana2002 | last post by:
Hi All; I want to use loop to find a specific text ( Drawing Name) in an excel range, make that cell active, copy the data from the cell in the column accross from the cell containning the (...
1
by: Arielle | last post by:
The Problem: Currently working on a way to catalog a large flux of files into a database. The files are for the most part uniform but some of the flags in the database fields vary depending on the...
2
by: dpw.asdf | last post by:
I have been searching all over for a solution to this. I am new to Python, so I'm a little lost. Any pointers would be a great help. I have a couple hundred emails that contain data I would like to...
5
by: Phil Berkey | last post by:
I'd like to ask a question and have the user type a specific answer into a field. how do I validate the answer. Any help would be great! <script type="text/javascript"> <!-- function...
5
by: Chocolade | last post by:
All the solutions here are great. But for now im keeping on my own code cuz i want also to learn the way i started to do it. So what i did so far is: private void inloop() {
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.