Computing.Net > Forums > Office Software > Excel Validation Reset

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Excel Validation Reset

Reply to Message Icon

Name: oldredfox
Date: September 28, 2004 at 07:39:56 Pacific
OS: Windows XP
CPU/Ram: ---
Comment:

Hi,

Does anybody know how I can limit a cell with a fromula so that when it comes up with a negative number it resets to 0. I have tried data validation to no avail (it is for input data not output). Any help on this subject would be much appeciated.

Thanks in Advance.



Sponsored Link
Ads by Google

Response Number 1
Name: GIS_tech
Date: September 28, 2004 at 13:58:43 Pacific
Reply:

I am not sure if you need the formula to remain in place or not, but this macro I created will check to see if the cell has a formula in it, and if the value of the formula produces a negative result. If the result is negative, then it will reset the cell to 0 (zero). Note: It will replace the formula in the cell with a zero.


Copy and Paste in a new Macro:
___________________________________
Sub del_negatives()
Dim cell As Range
For Each cell In Selection.Cells
If cell.HasFormula And cell.Value < 0 Then
cell.Value = 0
End If
Next
End Sub
______________________________________
Note: You have to manually select your range of cells.


Hope it helps..


GIS_tech.


0

Response Number 2
Name: Bryco
Date: September 28, 2004 at 17:22:14 Pacific
Reply:

I don't know what formula or what cell references but let's say:
A1=4
B1=16
and C1 is the cell with your formula of
=A1-B1
(Result is -12)

Instead, in C1 use:
=IF(A1-B1<0,0,A1-B1)
Meaning:
If A1 minus B1 is less than zero then zero else A1 minus B1.
(Result is 0)
Note: A1 minus B1 can be any formula you like.

HTH
Bryan


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More


Outlook images in signitu... Outlook 2003 Newsgroup bu...



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Office Software Forum Home


Sponsored links

Ads by Google


Results for: Excel Validation Reset

Excel - Validation www.computing.net/answers/office/excel-validation/7979.html

Excel Data Validation: www.computing.net/answers/office/excel-data-validation/9748.html

lines within excel file www.computing.net/answers/office/lines-within-excel-file/5543.html