• 0

# Case Statement for finding records that are between two numbers

## Question

I need to flag records that are either 15% or 30%. The first WHEN argument works, but the will not verify when the second argument is added. Error "near ("

CASE
WHEN SUM([@calcfield:4])/AVG([@calcfield:7]) <=.015 THEN '15%'
WHEN SUM([@calcfield:4])/AVG([@calcfield:7]) <=.03  AND >=.016 THEN '30%'

ELSE ''
END

## Recommended Posts

• 1

Hello @Hiperf,

As I understand, you use this formula in Totals & Aggregations.

It looks like one condition is missing.

CASE
WHEN SUM([@calcfield:4])/AVG([@calcfield:7]) <=.015 THEN '15%'
WHEN SUM([@calcfield:4])/AVG([@calcfield:7]) <=.03  AND SUM([@calcfield:4])/AVG([@calcfield:7]) >=.016 THEN '30%'

ELSE ''
END

Hope this helps.

##### Share on other sites

• 0

Thanks Coopper, that worked!

##### Share on other sites

• 0

Hi!

For more details about the formula, you may check this howto article: https://howto.caspio.com/function-reference/

Most of the functions available in Caspio are listed here.

## Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

×   Pasted as rich text.   Paste as plain text instead

Only 75 emoji are allowed.