Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 59
Default If / And / Or Macro

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.
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,501
Default If / And / Or Macro

Try this

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

Mike

"Graeme" wrote:

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.

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 59
Default If / And / Or Macro

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.

"Mike H" wrote:

Try this

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

Mike

"Graeme" wrote:

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.

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,091
Default If / And / Or Macro

Please state your question in the context of its environment. Don't waste
our time.

Tyro

"Graeme" wrote in message
...
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.



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
need help to update macro to office 2007 macro enabled workbook jatman Excel Discussion (Misc queries) 1 December 14th 07 01:57 PM
Macro Help Needed - Excel 2007 - Print Macro with Auto Sort Gavin Excel Worksheet Functions 0 May 17th 07 01:20 PM
My excel macro recorder no longer shows up when recording macro jack Excel Discussion (Misc queries) 1 February 5th 07 09:31 PM
My excel macro recorder no longer shows up when recording macro jack Excel Discussion (Misc queries) 3 February 5th 07 08:22 PM
Macro needed to Paste Values and prevent Macro operation thunderfoot Excel Discussion (Misc queries) 1 June 11th 05 12:44 AM


All times are GMT +1. The time now is 05:27 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"