#1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Rob Rob is offline
external usenet poster
 
Posts: 718
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 15,768
Default 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



  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Rob Rob is offline
external usenet poster
 
Posts: 718
Default 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




  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 15,768
Default 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






  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,886
Default 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






Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Need some comments on my Utility_Move class module. jchen Excel Worksheet Functions 0 August 21st 06 07:05 PM
Creating a Custom Excel Function to Calculate Gini Coefficients [email protected] Excel Worksheet Functions 3 February 21st 06 10:15 PM
Date & Time mully New Users to Excel 4 May 23rd 05 11:56 AM
Conversion SVC Excel Worksheet Functions 9 February 28th 05 02:29 PM
HOW CAN I GET OFFICE 2003 EXCEL BASIC TO NEST FUNCTIONS LIKE EXCE. Robert AS Excel Worksheet Functions 4 December 2nd 04 10:49 AM


All times are GMT +1. The time now is 09:15 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"