Need help with nested IF comparison....

  • Thread starter Thread starter Dan B
  • Start date Start date
D

Dan B

Need some help with correct syntax...
I have 3 columns of data to compare. In the 2nd and 3rd columns, I want to
look for matching numbers. Where a match is found, I want to check for a 1
in the 1st column. If all that matches, I want to copy the matching number
in the 3rd column to a blank 4th column.

Basically, If B2 = any number in C2 thru C50, and A2=1 then copy B2 to D2.

I hope that makes sense.

Thanks
 
if Range("A2").Value = 1 and _
Application.Countif(Range("C2:C50"), _
Range("B2").Value) > 0 then
Range("D2").Value = Range("B2").Value
End If


for for a formula

=if(And(A2=1,countif(C2:C50,B2)>0),B2,"")
 
Hi Dan

i think the following formula for D2 gives you what you're after
=IF(AND(COUNTIF($C$2:$C$50,B2),A2=1),B2,"")

Cheers
JulieD
 

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

Back
Top