Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 57
Default Multiple tests for a condition

Dear All,

I want to execute a statement if two cells meet the same condition (ie not
empty).

Basically, I want the vba syntax for the formula

if(or(A1, B1, <""), doThing, doNoThing)

Many TIAs

Matilda
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Multiple tests for a condition

=if(and(a1<"",b1<""),"dothing", "donothing")

Matilda wrote:

Dear All,

I want to execute a statement if two cells meet the same condition (ie not
empty).

Basically, I want the vba syntax for the formula

if(or(A1, B1, <""), doThing, doNoThing)

Many TIAs

Matilda


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 57
Default Multiple tests for a condition

Thanks Dave, but I want to put the test in a vba sub, in an if...then...else
statement. Sorry if I did not make myself clear.

I tried concocting something like that statement , which I would put in a
formula, and got error messages I couldn't interpret.

Matilda



"Dave Peterson" wrote:

=if(and(a1<"",b1<""),"dothing", "donothing")

Matilda wrote:

Dear All,

I want to execute a statement if two cells meet the same condition (ie not
empty).

Basically, I want the vba syntax for the formula

if(or(A1, B1, <""), doThing, doNoThing)

Many TIAs

Matilda


--

Dave Peterson

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 26
Default Multiple tests for a condition

Matilda wrote:

Dear All,

I want to execute a statement if two cells meet the same condition (ie not
empty).

Basically, I want the vba syntax for the formula

if(or(A1, B1, <""), doThing, doNoThing)

Many TIAs

Matilda


If Not IsEmpty(Range("a1")) Then
If Not IsEmpty(Range("b1")) Then
dostuff
End If
End If


--
Gordon Rainsford

London UK
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 57
Default Multiple tests for a condition

A simple nested if! Negated.

Didn't occur to me... thanks Gordon!

"Gordon Rainsford" wrote:

Matilda wrote:

Dear All,

I want to execute a statement if two cells meet the same condition (ie not
empty).

Basically, I want the vba syntax for the formula

if(or(A1, B1, <""), doThing, doNoThing)

Many TIAs

Matilda


If Not IsEmpty(Range("a1")) Then
If Not IsEmpty(Range("b1")) Then
dostuff
End If
End If


--
Gordon Rainsford

London UK

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
Multiple Conditional tests with Sumproduct ryguy7272 Excel Worksheet Functions 6 December 20th 08 05:09 PM
Get highest scores multiple tests & students Ptyrider Excel Discussion (Misc queries) 3 January 14th 07 07:02 AM
Using Multiple Tests and Sounds With Worksheet Macros Carl Excel Discussion (Misc queries) 3 July 1st 06 07:35 PM
Countif Using Multiple Logic Tests Carl Excel Worksheet Functions 3 June 4th 06 07:09 AM
Average a group of tests for grade, some tests not taken by all. Scafidel Excel Discussion (Misc queries) 4 August 19th 05 03:50 AM


All times are GMT +1. The time now is 08:11 AM.

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"