Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
 
Posts: n/a
Default using IF function to copy, but leave populated cell alone

I am using the IF function to look for a particular word and copy it to
another cell.

H2: =IF(A2="Example Text",A2, "")

The problem is that if the word "Example Text" is not found it deletes
anything in the target cell or puts FALSE into the target cell (if I
take out the "").

How can I preserve the text in the target cell if "Example Text" is not
there?

any help would be greatly appreciated!!

  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
davemorrison
 
Posts: n/a
Default using IF function to copy, but leave populated cell alone

you are asking
if A2 = Example Text then Example Text
if not then Blank

is this what you want??

maybe
=if(A2="Example Text","",A2)

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
 
Posts: n/a
Default using IF function to copy, but leave populated cell alone

Not exactly (thanks for the try)... that puts a blank where some test
was that I want to keep.

It would be more like =IF(A1="yes","yes", DO NOTHING)

where do nothing means leave that cell alone!

Befo
A B
1 example text (blank)
2 BlahBla goodstuff
3 example text (blank)

After:
A B
1 example text example text
2 BlahBla goodstuff
3 example text example text

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
JMB
 
Posts: n/a
Default using IF function to copy, but leave populated cell alone

Whatever other data you want in the cell if the criteria is not met should be
your third parameter. Or, your third parameter could be another if statement
to test for some other data, and if that is not found, return a "". Unless
they are nested or concatenated, two functions or pieces of data cannot
occupy the same cell.

IF(A1="yes",A1,other data)

IF (A1="yes",A1,IF(test for other data, other data, ""))


" wrote:

Not exactly (thanks for the try)... that puts a blank where some test
was that I want to keep.

It would be more like =IF(A1="yes","yes", DO NOTHING)

where do nothing means leave that cell alone!

Befo
A B
1 example text (blank)
2 BlahBla goodstuff
3 example text (blank)

After:
A B
1 example text example text
2 BlahBla goodstuff
3 example text example text


  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
JMB
 
Posts: n/a
Default using IF function to copy, but leave populated cell alone

One other thing, you could enter the first IF statement I suggested in a
third column, then copy this third column, click Edit/Paste Special/Values
over your original data in column B.

Just be sure to back up before trying anything new.


" wrote:

Not exactly (thanks for the try)... that puts a blank where some test
was that I want to keep.

It would be more like =IF(A1="yes","yes", DO NOTHING)

where do nothing means leave that cell alone!

Befo
A B
1 example text (blank)
2 BlahBla goodstuff
3 example text (blank)

After:
A B
1 example text example text
2 BlahBla goodstuff
3 example text example text




  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
 
Posts: n/a
Default using IF function to copy, but leave populated cell alone

Here is what I ended up using in VBA

Dim TheCell As Range

For C = 1 To 100
Set TheCell = Cells(C, 2)
If IsEmpty(TheCell.Value) Then
TheCell.Value = TheCell.Offset(0, -1).Value
End If
Next C
End Sub

use a second loop if you want to continue to add the text to addition
cells


JMB wrote:
One other thing, you could enter the first IF statement I suggested in a
third column, then copy this third column, click Edit/Paste Special/Values
over your original data in column B.

Just be sure to back up before trying anything new.


" wrote:

Not exactly (thanks for the try)... that puts a blank where some test
was that I want to keep.

It would be more like =IF(A1="yes","yes", DO NOTHING)

where do nothing means leave that cell alone!

Befo
A B
1 example text (blank)
2 BlahBla goodstuff
3 example text (blank)

After:
A B
1 example text example text
2 BlahBla goodstuff
3 example text example text



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
disabling the copy paste function in a cell sam Excel Worksheet Functions 0 February 22nd 06 02:10 PM
how to count the number of text frequencies and copy to other cell DG Excel Worksheet Functions 1 October 6th 05 07:11 PM
What worksheet function will formatlessly copy cell contents? MargueriteL Excel Worksheet Functions 1 June 7th 05 04:16 AM
Function syntax to compare cell contents ES Excel Worksheet Functions 2 May 18th 05 03:53 PM
copy a cell value not its function KC Mao Excel Discussion (Misc queries) 2 December 4th 04 04:30 AM


All times are GMT +1. The time now is 04:59 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"