Go Back   PCMech Forums > Help & Discussion > Software Discussion & Support

Need Some Help? Type Your Keywords Here:

Reply
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Old 07-07-2003, 05:52 AM   #1
Member (6 bit)
 
Join Date: Jun 2002
Location: Scotland,UK
Posts: 54
Please help with Excel

Is it possible to format a cell so that it can't accept negative figures?

I can set it up so the sum of this cell is one cell minus another but I do not want a negative answer only for the answer to go down to zero.

e.g. 5-10= -5 but I would like it to go only as low as zero.

This may seem strange but it is to make a spreadsheet for my tax return and an allowance will be higher than tax due but will only reduce the figure to zero .

I hope that makes sense.

My version is Excel 2000.
ejnallstars is offline   Reply With Quote
Old 07-07-2003, 08:33 AM   #2
Member (10 bit)
 
Join Date: Jul 1999
Location: Pickerington, OH-IO
Posts: 875
You could probably write an If, Then formula to do this.
Prew is offline   Reply With Quote
Old 07-07-2003, 10:08 AM   #3
Member (8 bit)
 
Cirerrek's Avatar
 
Join Date: Jun 2000
Location: MO
Posts: 232
Code:
=IF(AND(ISNUMBER(C10),C10>0),C10,"")
This basically says that IF C10 is really a number AND C10 is greater than 0 THEN display C10, OTHERWISE display nothing.

Cirerrek
Cirerrek is offline   Reply With Quote
Old 07-07-2003, 10:19 AM   #4
Member (6 bit)
 
Join Date: Jun 2002
Location: Scotland,UK
Posts: 54
Thanks Cirerrek

This formula works perfectly. I could get the figure to dispaly 0 if in the negative but not the actual figure if in the positive.

It does work but I can`t say that I really understand it.

Thanks again.
ejnallstars is offline   Reply With Quote
Old 07-07-2003, 10:25 AM   #5
Professional gadfly
 
doctorgonzo's Avatar
 
Join Date: Jan 2002
Location: Minneapolis, MN
Posts: 6,364
Send a message via MSN to doctorgonzo
The IF function works like this:

IF(condition, what to do if condition is true, what to do if condition is false)

It evaluates the condition, and if it is true it returns the middle argument in the list. If it is false, it returns the last argument in the list. In your example, if C10 is a number and is positive (that's the condition), it displays C10 (the middle argument). Otherwise, it displays a blank (those quotes that make up the last argument in the list).
doctorgonzo is offline   Reply With Quote
Old 07-07-2003, 10:29 AM   #6
Member (8 bit)
 
Cirerrek's Avatar
 
Join Date: Jun 2000
Location: MO
Posts: 232
If you want it also to display 0 then just change the formula to look like this:

Code:
=IF(AND(ISNUMBER(C10),C10>=0),C10,"")
which says

IF C10 is really a number AND C10 is greater than or equal to 0 THEN display C10, OTHERWISE display nothing.

IF(logical_test,[value_if_true],[value_if_false])

the [] don't really need to be there

AND(logical1,[logical2],...)

The AND just lets you pass more than one logical statement, in this case 1) Is it a number? and 2) Is it greater than or equal to 0?

Cirerrek
Cirerrek is offline   Reply With Quote
Old 07-07-2003, 10:32 AM   #7
Member (6 bit)
 
Join Date: Jun 2002
Location: Scotland,UK
Posts: 54
Thanks Guys

This forum never lets me down.

Now I can work out my tax return any help with paying it?
ejnallstars is offline   Reply With Quote
Old 07-07-2003, 10:36 AM   #8
Member (8 bit)
 
Cirerrek's Avatar
 
Join Date: Jun 2000
Location: MO
Posts: 232
Uhm, considering taxes were due a while ago, I'm going to have to say no help here (thinks interest payments alone might be nasty), but for next year you might want to modify your W2
Cirerrek is offline   Reply With Quote
Old 07-07-2003, 09:39 PM   #9
Member (10 bit)
 
David_Jones's Avatar
 
Join Date: May 2000
Location: New Zealand
Posts: 546
A simpler solution, without the error checking to see if you have actually entered a number, would be:

=max(0, A1 - A2)

Where A1 and A2 contain your original 5, and 10 (say).

This will evaluate to zero with those numbers, but if A2 if greater than A1, then it will give the difference.

HTH,

David.
David_Jones is offline   Reply With Quote
Old 07-09-2003, 01:02 AM   #10
Member (6 bit)
 
Join Date: Jun 2002
Location: Scotland,UK
Posts: 54
Thanks David

That works also and seems an easier formula.
ejnallstars is offline   Reply With Quote
Reply

Bookmarks

Still Need Help? Type Your Keywords Here:


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 02:06 AM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
SEO by vBSEO 3.6.0 PL2