# Crystal Reports - Formula - comparison of values

I need to build a formula that has 4 potential results. I have it working with 3 but can't figure the 4th piece out. Here is the formula from mlmcc

Local NumberVar Q408Q109;
Local NumberVar Q208Q308;

Q408Q109 := ({#Running Q408 and Q109});
Q208Q308 := ({#Running 2Q - 3Q Total});

If Q408Q109  > Q208Q308  then
"UP"
else if (Q408Q109 = 0) and (Q208Q308 = 0)  then
"INACTIVE"
else
"DOWN"

After a closer look at the data, I need a 4th variable. Here's an example of the data that would be represented;
1) UP  - Up from last time period (2 cases in Jan and 3 cases in Feb)
2) Down  - Down from last time period (3 cases in Jan and 2 cases in Feb)
3) Inactive - Shows no activity in either time period being compared (i.e. Zero cases in Jan and Zero cases in Feb)
4) FLAT - Shows activity in both time periods but each is equal to the other (i.e., 3 cases in Jan and 3 cases in Feb) so NOT INACTIVE but FLAT

I tried something like this to read if (Q408Q109 = Q208Q308) and = 0, then FLAT. Here's my attempt at the formula:
else if ((Q408Q109 = Q208Q308) <> 0)  then
"FLAT"
but I get an error indicating that Crystal is expecting a boolean in pace of the "0" which I understand but I don't know how to fix to get the result I am after.

Any help would be GREAT! Thanks in Advance!

###### Who is Participating?

Commented:
Local NumberVar Q408Q109;
Local NumberVar Q208Q308;

Q408Q109 := ({#Running Q408 and Q109});
Q208Q308 := ({#Running 2Q - 3Q Total});

If Q408Q109  > Q208Q308  then
"UP"
else if (Q408Q109 = 0) and (Q208Q308 = 0)  then
"INACTIVE"
else if Q408Q109  < Q208Q308
"DOWN"
else
"FLAT"

mlmcc
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.