ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   How do I change my negative values to zeros in Excel? (https://www.excelbanter.com/excel-discussion-misc-queries/159928-how-do-i-change-my-negative-values-zeros-excel.html)

N_Davis

How do I change my negative values to zeros in Excel?
 
I need to convert data from mg/L to mg/kg, but before I can do that I need to
get rid of my negative values. How do I change, for example, -0.005 to zero
without manually doing so (I have hundreds of negative values and do not have
the time or patience to do so)?

Harald Staff[_2_]

How do I change my negative values to zeros in Excel?
 
Hi

Helper column with formula like
=MAX(A1,0)
Fill down, then replace formula with values.

HTH. Best wishes Harald

"N_Davis" wrote in message
...
I need to convert data from mg/L to mg/kg, but before I can do that I need
to
get rid of my negative values. How do I change, for example, -0.005 to
zero
without manually doing so (I have hundreds of negative values and do not
have
the time or patience to do so)?



Gord Dibben

How do I change my negative values to zeros in Excel?
 
Just the thing for those with no time or patience............

Sub foo()
For Each cell In ActiveSheet.UsedRange
If cell.Value < 0 Then
cell.Value = 0
End If
Next
End Sub


Gord Dibben MS Excel MVP

On Thu, 27 Sep 2007 10:57:02 -0700, N_Davis
wrote:

I need to convert data from mg/L to mg/kg, but before I can do that I need to
get rid of my negative values. How do I change, for example, -0.005 to zero
without manually doing so (I have hundreds of negative values and do not have
the time or patience to do so)?




All times are GMT +1. The time now is 02:52 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com