ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Compare two cells, if equal move a third cell to another cell (https://www.excelbanter.com/excel-discussion-misc-queries/214924-compare-two-cells-if-equal-move-third-cell-another-cell.html)

Mike

Compare two cells, if equal move a third cell to another cell
 
Need a formula to compare the content of two cells and if equal, move (copy)
the content of a third cell to another cell. Any help would be appeciated.

Mike

Mike H

Compare two cells, if equal move a third cell to another cell
 
Hi,

Excel formula can't 'push' data to another cell they can only 'Pull' data
from cells so may be this

=IF(A1=B1,C1,"")

Mike

"Mike" wrote:

Need a formula to compare the content of two cells and if equal, move (copy)
the content of a third cell to another cell. Any help would be appeciated.

Mike


Gary''s Student

Compare two cells, if equal move a third cell to another cell
 
Say we want to test if A1 equals A2, then copy A3 to A4

Try this short macro:

Sub surphace()
Set r1 = Range("A1")
Set r2 = Range("A2")
Set r3 = Range("A3")
Set r4 = Range("A4")
If r1.Value = r2.Value Then
r3.Copy r4
End If
End Sub
--
Gary''s Student - gsnu200822


"Mike" wrote:

Need a formula to compare the content of two cells and if equal, move (copy)
the content of a third cell to another cell. Any help would be appeciated.

Mike


Gord Dibben

Compare two cells, if equal move a third cell to another cell
 
Formulas cannot move or copy.

You would need a fourth cell with a formula like =IF(A1=B1,C1,"not equal")

Note: minimal error-trapping in the formula posted.

To actually copy or move you would need VBA


Gord Dibben MS Excel MVP

On Tue, 30 Dec 2008 11:09:01 -0800, Mike
wrote:

Need a formula to compare the content of two cells and if equal, move (copy)
the content of a third cell to another cell. Any help would be appeciated.

Mike




All times are GMT +1. The time now is 11:13 PM.

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