4 Replies Latest reply: Dec 14, 2011 7:28 AM by SEA_1970

# IF statement in expression

Hi everybody,

I have a question using a IF statement in an expression. I'm not sure this is a possible way or even the best way, but after 2 days trying and failing, the time has come to search for expert help.

The case is; In my QlickView I have one row of measurements given from our customers. The name of this row is "Height".

In row 2 I have information of what the height really was after a controll measurement done by my colleagues. The name of this row is “RealHeight”.On top of that, I have a row with tolerances, based on the type of packaging.  The names of those two rows are “Tolerances” and “Packaging”.

I want to make a check if the given “Height” from our customers is inside or outside the measurement done by our colleagues +/- the tolerance by setting 1 when the height is outside the tolerances and 0 when it is inside the tolerances.

I’ve tried this IF-statement, but it doesn’t give me the expected result.

SUM(IF((RealHeight + Tolerances) > Height, 0,

IF((RealHeight -Tolerances)< Height, 0, 1)))

Any ideas?

• ###### Re: IF statement in expression

Hi,

SUM(IF(((RealHeight + Tolerances) > Height), 0,

IF(((RealHeight -Tolerances)< Height), 0, 1)))

Does this help?

• ###### IF statement in expression

Unfortunately, the result is the same.

Thanks anyway.

• ###### Re: IF statement in expression

Hi,

Try this

IF(Sum(RealHeight + Tolerances) > Sum(Height), 0,

IF(Sum(RealHeight -Tolerances)< Sum(Height), 0, 1)))

• ###### IF statement in expression

The result appears to be the same.

If I run this statement alone, I've got an correct count for all products outside the maximum tolerances:

IF(Sum(RealHeight + Tolerances) > Sum(Height), 0, 1)

but the combination between maximum tolerances and minimum tolerances would not work.