Excel functions

  • Thread starter Matthew Williamson
  • Start date
M

Matthew Williamson

I want to use the following IF ... THEN.

If any cell in column D contains x then put y in the same row in colum
G
and
If any cell in column D contains a then put b in the same row in colum
H

Can this be done
 
S

Spencer101

Matthew said:
I want to use the following IF ... THEN.

If any cell in column D contains x then put y in the same row in colum
G
and
If any cell in column D contains a then put b in the same row in colum
H

Can this be done?

It would involve a formula in G and one in H.

In G1 put *=IF(D1="X","Y","")* and in H1 put *=IF(D1="A","B","")*the
copy both formulas down as needed
 
M

Matthew Williamson

Thank you. I had hoped there would be one instruction to analyse th
column
 
D

Don Guillett

I want to use the following IF ... THEN.

If any cell in column D contains x then put y in the same row in column
G
and
If any cell in column D contains a then put b in the same row in column
H

Can this be done?

Or use a worksheet_change event macro to make it automatic without any formulas. Right click sheet tab>view code>insert

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Count > 1 Or Target.Column <> 4 Then Exit Sub
If UCase(Target) = "X" Then Target.Offset(, 3) = "Y"
If UCase(Target) = "A" Then Target.Offset(, 4) = "B"
End Sub
 

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