×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
• Talk With Other Members
• Be Notified Of Responses
• Keyword Search
Favorite Forums
• Automated Signatures
• Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

#### Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

# 1 Formula For Different Products

## 1 Formula For Different Products

(OP)
Using crystal version 14 with an MS SQL Table

This formula is going in the suppressed details section and then I have a summary in the group footer

I’m fairly certain I have done something like this before but today I just can’t get the syntax correct. Would appreciate your help. Wanting to have 1 formula to capture the sales dollars for 2 different products. I created this and it is erroring out.

My formula is:

IF {Acct#} = 272044716001 AND
{Product_#} in ["BP0021"] and
{Year} = 2019
THEN
{Sell Dollars}
ELSE 0

or

{Acct#} = 272044050000 AND
{Product_#} in ["WE33"] and
{Year} = 2019
THEN
{Sell Dollars}
ELSE 0

When I check the formula I’m told The remaining text does not appear to be part of the formula and highlights the last THEN {Sell Dollars}ELSE 0

What is the proper syntax for this assuming it can be done.

Thanks

Use this syntax:

If
(
(
acctno=123 and
Prodno=“ABC”
) or
(
acctno=456 and
Prodno=“DEF”
)
) and
Year=2019 then
Sales\$ else
0

-LB

### RE: 1 Formula For Different Products

(OP)
Thanks Lbass, as usual you are spot on.

#### Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

#### Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Close Box

# Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

• Talk To Other Members
• Notification Of Responses To Questions
• Favorite Forums One Click Access
• Keyword Search Of All Posts, And More...

Register now while it's still free!