## How to make a condition for making a SUM - Correction

### How to make a condition for making a SUM - Correction

Hello

Is there an alternative for the Excel-function "SumIF" in Access?
Why?

I have one table with profits and expenses.
First field, description (text): indication like "Expense" or "Profit"
Second field (numerical): the amount

It's easy to make a total and sub totals in a report. Even the wizard can do
this.

Description Amount
Income A 100
Income B 100
Income C 100
Sum(Amount) 300

Expense A 100
Expense B 100
Sum(Amount) 200

Sum(Amount) 500 That's what I get right now.

What I like to compute: Sum(Income) minus Sum(Expense).
So the result should be 100 instead of 500.

How to make the calculation "Income" minus "Expense"?

Thanks !!!

Dirk Goossens
Office: +32 55 237609
Mobile: +32 495 52 35 90

Vrij Instituut Sint-Lucas
Gelukstede 2 - BE- 9700 Oudenaarde

### How to make a condition for making a SUM - Correction

Yes.
Because Access is a database, not a spreadsheet.

In Jet SQL, you could use either the IIF function or the Switch
function.

On Thu, 1 Dec 2005 11:01:41 +0100, "Dirk Goossens" < XXXX@XXXXX.COM >

--
Drive C: Error. (A)bort (R)etry (S)mack The Darned Thing

### How to make a condition for making a SUM - Correction

do

sum(iif([indication]="Profit",[Amount],-[Amount]))