#1   Report Post  
sheila_d_pratt
 
Posts: n/a
Default If..then statement

Hi,

I have the following If statement;

If query ID = "SAPBEXq0002" Then
I want to add another query ID to this statement. I have tried separating
them by a comma and got an error. e.g. If query ID = "SAPBEXq0002",
"SAPBEXq006" Then.

What is the best way to write this so that either query can be used.

Thanks
--
sheila
  #2   Report Post  
Chip Pearson
 
Posts: n/a
Default

Sheila,

Use code similar to the following:

If queryID = "SAPBEXq0002" Or queryID = "SAPBEXq006" Then


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com




"sheila_d_pratt" wrote
in message
...
Hi,

I have the following If statement;

If query ID = "SAPBEXq0002" Then
I want to add another query ID to this statement. I have tried
separating
them by a comma and got an error. e.g. If query ID =
"SAPBEXq0002",
"SAPBEXq006" Then.

What is the best way to write this so that either query can be
used.

Thanks
--
sheila



  #3   Report Post  
sheila_d_pratt
 
Posts: n/a
Default

Thanks for your help Chip!

"sheila_d_pratt" wrote:

Hi,

I have the following If statement;

If query ID = "SAPBEXq0002" Then
I want to add another query ID to this statement. I have tried separating
them by a comma and got an error. e.g. If query ID = "SAPBEXq0002",
"SAPBEXq006" Then.

What is the best way to write this so that either query can be used.

Thanks
--
sheila

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
ms excel IF statement w/pictures? Scott Links and Linking in Excel 4 March 1st 05 09:54 AM
What statement to use? Paul Excel Worksheet Functions 6 February 13th 05 05:23 PM
How do I fix a circular reference in a financial statement? drjayhawk25 Excel Discussion (Misc queries) 0 February 7th 05 05:19 PM
7+ nested if statement? Turi Excel Worksheet Functions 3 December 20th 04 07:55 PM
Statement lintan Excel Worksheet Functions 1 December 2nd 04 11:31 PM


All times are GMT +1. The time now is 06:02 AM.

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

About Us

"It's about Microsoft Excel"