Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations GregLocock on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Too Many OR Statements - need loop

Status
Not open for further replies.

subengr

Structural
May 10, 2010
9
If I have a unity check matrix:


.67
.90
.55
UC = .54
.90
1.03
.68

I want it to do a check of all the numbers in the matrix and if a number is above one I want it to say "NG", otherwise write "OK". However I dont want to do a bunch of OR statements because the real matrix is a lot bigger (if UC[1]>1 OR UC[2]>1,...,etc).

How can I create a loop that does the same thing? Right now I doing if UC[n]>1 then "NG" but it doesnt seem to want to run the way I wrote it.

Thanks
 
Replies continue below

Recommended for you

Why can't you use the MAX function?

TTFN

FAQ731-376
 
You are right...but it still bugs me that I cant get that loop to work. Thanks
 
There are still brute force and ignorance approaches:

IF(SUM(IF(a[n >= 1,1,0), "NG" , "OK"))) is one approach, where SUM is the summation operator. You essentially do a SUMIF the value is greater than or equal to 1, and if the sum is greater than 0, then the second if outputs "NG, otherwise "OK" There is a bit of a cheat, since you should do IF(SUM(blah)>0

TTFN

FAQ731-376
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor