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

M

Mike

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
 
M

Mike H

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
 
G

Gary''s Student

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
 
G

Gord Dibben

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top