If / And / Or Macro

  • Thread starter Thread starter Graeme
  • Start date Start date
G

Graeme

Basic question: I am trying to write a macro that looks to see whether A1 =
"X" and also if any of A2...10 = "Y", then Statement A, else Statement B.
Thank you in advance.
 
Try this

=IF(AND(A1="x",COUNTIF(A2:A10,"y")>0),"Statement A","Statement B")

Mike
 
Mike - thanks for the quick response. I see how this would work as an excel
formula, but if it's a line of code in a macro, does it need to be expressed
differently? thanks.
 
Please state your question in the context of its environment. Don't waste
our time.

Tyro
 

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