473,440 Members | 1,769 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,440 software developers and data experts.

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
Dec 1 '05 #1
2 1750

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" <di*****@skynet.be>
wrote:
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"?

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

Dec 1 '05 #2

"Dirk Goossens" <di*****@skynet.be> wrote in message
news:43***********************@news.skynet.be...
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


sum(iif([indication]="Profit",[Amount],-[Amount]))
Dec 1 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: ajay | last post by:
I have following code for a slide menu but i twiked it to work for a single level menu. Open it in a Browser to get a clear picture. I have 2 Qs 1) How to make first entry as non-link. i.e i...
12
by: Steven T. Hatton | last post by:
This is something I've been looking at because it is central to a currently broken part of the KDevelop new application wizard. I'm not complaining about it being broken, It's a CVS images. ...
7
by: Stefan | last post by:
Hi, I am trying to get my structure to be externed so I can use it in all my projects source files, but the code is generating errors. Here is some of my code: "Globals.cpp" typedef struct...
0
by: Dirk Goossens | last post by:
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...
23
by: centurian | last post by:
I have compiled following program with g++/gcc 3.3.1 and "MS Visual C++ 6" and it ran without any errors. Does this thing make any sense? Is it of some use or some problem with grammar/CFG of...
19
by: zzw8206262001 | last post by:
Hi,I find a way to make javescript more like c++ or pyhon There is the sample code: function Father(self) //every contructor may have "self" argument { self=self?self:this; ...
12
by: =?Utf-8?B?S2plbGw=?= | last post by:
Hello I've taken a four days training in C#, very good training, experienced teacher and all that, very positive. Went home spent a week making my first application, slightly more than the...
42
by: lorlarz | last post by:
Contrary to what one authority in the JavaScript field says: JavaScript does make errors when dealing with just with integers. This authority (Douglas Crockford.) says: "integer arithmetic in...
82
by: Bill David | last post by:
SUBJECT: How to make this program more efficient? In my program, a thread will check update from server periodically and generate a stl::map for other part of this program to read data from....
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.