![]() |
IF function
Hi,
I have a column where some values contain 0 (zero). I want to create an IF function, where, IF the value is 0 THEN change it to 1, ELSE do nothing (i.e. retain the original cell value). Thoughts... TIA |
IF function
Are you wanting to do this "in place" or do you need a formula in a
different cell? Formula in a different cell: =IF(ISNUMBER(A1),IF(A1=0,1,A1),"") Biff "Rob" wrote in message ... Hi, I have a column where some values contain 0 (zero). I want to create an IF function, where, IF the value is 0 THEN change it to 1, ELSE do nothing (i.e. retain the original cell value). Thoughts... TIA |
IF function
In place. So if A1 has a value of 132, I'd want to retain that value, whereas
if the next cell below, A2, had a 0 value, then have it changed to a 1. Thanks. "T. Valko" wrote: Are you wanting to do this "in place" or do you need a formula in a different cell? Formula in a different cell: =IF(ISNUMBER(A1),IF(A1=0,1,A1),"") Biff "Rob" wrote in message ... Hi, I have a column where some values contain 0 (zero). I want to create an IF function, where, IF the value is 0 THEN change it to 1, ELSE do nothing (i.e. retain the original cell value). Thoughts... TIA |
IF function
To do it in place you'll need to use a VBA procedure. I can't help you with
that. Biff "Rob" wrote in message ... In place. So if A1 has a value of 132, I'd want to retain that value, whereas if the next cell below, A2, had a 0 value, then have it changed to a 1. Thanks. "T. Valko" wrote: Are you wanting to do this "in place" or do you need a formula in a different cell? Formula in a different cell: =IF(ISNUMBER(A1),IF(A1=0,1,A1),"") Biff "Rob" wrote in message ... Hi, I have a column where some values contain 0 (zero). I want to create an IF function, where, IF the value is 0 THEN change it to 1, ELSE do nothing (i.e. retain the original cell value). Thoughts... TIA |
IF function
Hi Rob
This short piece of code posted below will do that. First, mark the range of cells where you want the conversion to take place, then run the macro. You will need to copy the code to your workbook, instructions follow the code Sub ChangeZerotoOne() Dim c As Range For Each c In Selection If c.Value = 0 Then c.Value = 1 Next c End Sub You can copy the code and paste it into your Visual Basic Editor (VBE) in a Standard Module located in your file. To do this, Alt + F11 (open VBE) Ctrl + R (open Project Explorer) Select the file name on the left Insert Module Paste code in Module David McRitchie has lots of useful help on his site at http://www.mvps.org/dmcritchie/excel/install.htm http://www.mvps.org/dmcritchie/excel/getstarted.htm -- Regards Roger Govier "Rob" wrote in message ... In place. So if A1 has a value of 132, I'd want to retain that value, whereas if the next cell below, A2, had a 0 value, then have it changed to a 1. Thanks. "T. Valko" wrote: Are you wanting to do this "in place" or do you need a formula in a different cell? Formula in a different cell: =IF(ISNUMBER(A1),IF(A1=0,1,A1),"") Biff "Rob" wrote in message ... Hi, I have a column where some values contain 0 (zero). I want to create an IF function, where, IF the value is 0 THEN change it to 1, ELSE do nothing (i.e. retain the original cell value). Thoughts... TIA |
All times are GMT +1. The time now is 02:35 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com