473,395 Members | 1,454 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,395 software developers and data experts.

Count Debits or Credits Amounts

36
Hello People

I need to know if is possible to count Debits or Credits Amounts for example:

IIF([field] = debits then 1 else 0

or

IIF([field] = Credits the 1 else 0

To count the portion in debits or Credits.

I need to type this IIF in a query to determine de calculation but i dont know how is the correct formatt for this..

Thanks every one
Feb 25 '08 #1
8 2327
Minion
108 Expert 100+
As taken from the MSDN:

Visual Basic for Applications Reference

IIf Function

Returns one of two parts, depending on the evaluation of an expression.

Syntax

IIf(expr, truepart, falsepart)

The IIf function syntax has these named arguments:

Part Description
expr Required. Expression you want to evaluate.
truepart Required. Value or expression returned if expr is True.
falsepart Required. Value or expression returned if expr is False.
So you would be looking at something like:
Expand|Select|Wrap|Line Numbers
  1. IIF([field] = "credit",1,0)
  2.  
Hope this helps.

- Minion -
Feb 25 '08 #2
cori25
83
Hello...

If you need to count the amount of Credits and Debits you have you would add these fields in your query:

CountCredits:iif([Credits]="Credit", 1, 0)

CountDebits:iif([Debits]="Debit", 1, 0)

This will number the accounts that you have that say "Credit" in the Credits field with a 1 and "Debit" in the Debits field with a 1. This is a great tool for when you are creating a pivot report in excel so that it will give you the total count of Credit and Debit accounts. I would syggest making 2 fields, 1 for Credits and 1 for Debits instead of combining them.

From your question, this is what I assumed you were asking, although, I was confused whether or not you wanted the amounts captured.
Feb 25 '08 #3
ElTipo
36
Thanks, but the field have amounts. If the amount is in black color like debits then count 1 else 0. Otherwise if is in red like credits count 1 else 0. I only one field for amounts the formatt I used to determine credit o debits in the text box report is $#,##0.00[Black];($#,##0.00)[Red];\0;

Hello...

If you need to count the amount of Credits and Debits you have you would add these fields in your query:

CountCredits:iif([Credits]="Credit", 1, 0)

CountDebits:iif([Debits]="Debit", 1, 0)

This will number the accounts that you have that say "Credit" in the Credits field with a 1 and "Debit" in the Debits field with a 1. This is a great tool for when you are creating a pivot report in excel so that it will give you the total count of Credit and Debit accounts. I would syggest making 2 fields, 1 for Credits and 1 for Debits instead of combining them.

From your question, this is what I assumed you were asking, although, I was confused whether or not you wanted the amounts captured.
Feb 25 '08 #4
cori25
83
You can not determine debits/credits in a query based on colors. You would have to have another field in your table to display whether or not they are credit or debit or you can use specific amounts to interpret this.
Feb 25 '08 #5
NeoPa
32,556 Expert Mod 16PB
What do you use to determine whether the record is a Credit or a Debit?
Do you really want a count? Or are you actually looking for a Sum of the values?
Mar 3 '08 #6
ElTipo
36
What do you use to determine whether the record is a Credit or a Debit?
Do you really want a count? Or are you actually looking for a Sum of the values?
Thanks Neo

- I determine credits and debits with this formatt $#,##0.00[Black];($#,##0.00)[Red];\0;

- Yes I want to count.
Mar 4 '08 #7
NeoPa
32,556 Expert Mod 16PB
...
- I determine credits and debits with this formatt $#,##0.00[Black];($#,##0.00)[Red];\0;
...
You mean negative numbers are credits and postive ones are debits yes?
...
- Yes I want to count.
OK
I will see if I can get another look at this later. Running late and have a home to go to ;)
Mar 4 '08 #8
NeoPa
32,556 Expert Mod 16PB
It seems that while I may have a home to go to, I have no viable means of transport just for now (motorbike broken down) so I'll have another look at this now.

Assuming a table ([Table]) and a field ([Field]) in that table, then you want some SQL like :
Expand|Select|Wrap|Line Numbers
  1. SELECT Count(IIf([Field]<0,Null,[Field])) AS NumDebits,
  2.        Count(IIf([Field]<0,[Field],Null)) AS NumCredits
  3. FROM [Table]
This is very basic and counts across the whole table. If you need your counts to be done by particular grouping, then we need to know that before we can help further.
Mar 4 '08 #9

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Jose Benito Gonzalez Lopez | last post by:
Hi there, Does anyone know how I could do in order to get/count the number of pages of a PDF file? (from python of course ;) ) Thanks beforehand. Cheers, Jose
198
by: Sridhar R | last post by:
>From technical point of view, I could not understand the the reasoning behind using Java in major companies. Sure that Python, is used in some, but still Java is considered as a sure-job...
4
by: jeff brubaker | last post by:
Hello, Currently we have a database, and it is our desire for it to be able to store millions of records. The data in the table can be divided up by client, and it stores nothing but about 7...
1
by: Kevin | last post by:
Group By - Client Sum - PastDue: Iif(DateDiff("d",,Date())>30,,0) Sum - Current: Iif(DateDiff("d",,Date())<31,,0) These 2 sum fields work fine, EXCEPT it is not summing my negative...
17
by: keith | last post by:
I am trying to get a exact count of different distinct entries in an Access column. At first, I was trying to work with three columns, but I've narrowed it down to one to simplify it. I've searched...
3
by: ret4rt | last post by:
Hello. I have a database with movies similar with imdb and i want to find out which directors have directed both thriller and drama movies. The output i want is like this "DIR_NAME,amount of...
7
by: =?Utf-8?B?TW9iaWxlTWFu?= | last post by:
Hello everyone: I am looking for everyone's thoughts on moving large amounts (actually, not very large, but large enough that I'm throwing exceptions using the default configurations). We're...
5
by: whitsey | last post by:
Here is what I have: SELECT (SELECT COUNT(*) AS SEARCHES FROM SEARCHES INNER JOIN GROUPS ON SEARCHES.SITE_ID = GROUPS.SITE_ID WHERE
12
by: subramanian100in | last post by:
Below is my understanding about count algorithms. Return type of count and count_if algorithms is iterator_traits<InputIterator>::difference_type. If the container contains more than...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...
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...

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.