# Subtracting a specific condition from a total value??

Hello, I am very new to Crystal Reports and I am the only one in my group using the software (which means I must become the expert--scary)

Anyway, I have two columns of data that I have entered via an excel spreadsheet. I could easily solve my issue using another column but I feel my issue can be solved writing a simple formula in Crystal Reports. Here is my issue:

Column 1 (C1) are line values of cost, the second column (C2) are account groups. I would like to write a formula that gives me a grand total of all of C1 minus a specific account group.

A $15

A $17

B $30

B $35

B $18

C $17

C $35

Gttl = $167

Formula

Gttl ($167) u2013 C ($52) = $115

I have tried this a few times, a few different ways

for example:

Sum({Item.C1}) u2013 ({Item.C1},{Item.C2},u201CCu201D)

But all I get in an error.

What am I doing horribly wrong?

Scott

PS: Again I am very new to this type of software. And thank you for your time.

##### Erika Atencio replied

Maybe this can help:

http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=7543&PID=23483

there it says:

I see where you were going with this lockwelle but I think this may be constant values of "C rows" being positive values and "D rows" being negative values.

If that is the case a formula field of to convert these could be used then Sum that formula field...

if {table.reporttype}="D" then -({table.amount}) else {table.amount}

Sum this formula field to get the total.