if i have data a, b, c, up to z in my table with specific amounts, how do i
get their sub-total if i don't want to include data l, m, n, o & p? how can
you sum it up and subtract those specific data that are excluded? what is the
code?
--
Message posted via http://www.accessmonster.com
|
|
0
|
|
|
|
Reply
|
enrico
|
12/4/2009 2:01:04 AM |
|
In query design, type an expression like this into the Field row:
Nz([a],0) + Nz([b],0) + Nz([c],0) + ...
The real problem here is that you've build a spreadsheet in Access.
Repeating columns like that is not the way you store data in a database: it
gives you exactly the kind of querying problems you are experiencing.
For info about the Nz() workaround to solve nulls, see item #2 in this
article:
http://allenbrowne.com/casu-12.html
--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
"enrico via AccessMonster.com" <u41845@uwe> wrote in message
news:a00ffd9cbffe9@uwe...
> if i have data a, b, c, up to z in my table with specific amounts, how do
> i
> get their sub-total if i don't want to include data l, m, n, o & p? how
> can
> you sum it up and subtract those specific data that are excluded? what
> is the code?
|
|
0
|
|
|
|
Reply
|
Allen
|
12/4/2009 4:59:53 AM
|
|
a, b, c, etc. are just representations. i have a table with field data
"Banks", "TransCount" and "Amount". for example, if have 30 banks and i want
to get the sum of the amount entered minus the amount of 5 banks. how will i
get it?
--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-queries/200912/1
|
|
0
|
|
|
|
Reply
|
enrico
|
12/4/2009 5:29:57 AM
|
|
Whatever the fields are called, use Nz() around each of them in your
expression.
If you have 30 banks represented as 30 columns, your schema is not
normalized.
--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
"enrico via AccessMonster.com" <u41845@uwe> wrote in message
news:a011d04a3d313@uwe...
> a, b, c, etc. are just representations. i have a table with field data
> "Banks", "TransCount" and "Amount". for example, if have 30 banks and i
> want
> to get the sum of the amount entered minus the amount of 5 banks. how will
> i
> get it?
|
|
0
|
|
|
|
Reply
|
Allen
|
12/4/2009 8:51:04 AM
|
|
Are you trying to get the sum in a query?
What method do you have to identify the banks you don't want?
SELECT Sum(Amount) as Total
FROM SomeTable
WHERE Banks Not In ("First National","Bank of America")
Or use the VBA DSUM function
DSUM("Amount","SomeTable","Banks Not In ('First National','Bank of America')")
If you need more detail in the response you need to provide more detail on the
what you want.
By the way, in query design view
== Add your table
== Add the Banks and Amount fields
== Under banks enter criteria to exclude the banks you don't want
Not IN ('First National','Bank of America')
== Select View: Totals from the menu
== Change GROUP BY to WHERE under Banks field
== Change GROUP BY to SUM under the Amount field
John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
enrico via AccessMonster.com wrote:
> a, b, c, etc. are just representations. i have a table with field data
> "Banks", "TransCount" and "Amount". for example, if have 30 banks and i want
> to get the sum of the amount entered minus the amount of 5 banks. how will i
> get it?
>
|
|
0
|
|
|
|
Reply
|
John
|
12/4/2009 1:31:13 PM
|
|
thank you. that's exactly what i wanted. but can you add another condition to
the query? for example, aside from the banks that are excluded you add a
condition that it will only show those transactions with a field in my table
"walk-in"
--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-queries/200912/1
|
|
0
|
|
|
|
Reply
|
enrico
|
12/10/2009 12:40:39 AM
|
|
You are a bit unclear on what you want. Hopefully this is what you want
SELECT Sum(Amount) as Total
FROM SomeTable
WHERE Banks Not In ("First National","Bank of America")
AND SomeField = "Walk-In"
== Add the field that contains Walk in to the query
== Enter the following in the criteria for that field
"Walk-In"
If that fails, then you need to take a look at the field and determine its
field type.
John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
enrico via AccessMonster.com wrote:
> thank you. that's exactly what i wanted. but can you add another condition to
> the query? for example, aside from the banks that are excluded you add a
> condition that it will only show those transactions with a field in my table
> "walk-in"
>
|
|
0
|
|
|
|
Reply
|
John
|
12/10/2009 2:47:23 PM
|
|
|
6 Replies
188 Views
(page loaded in 0.101 seconds)
Similiar Articles: Adding an additional forumula to my SUMPRODUCT formula - microsoft ...add or subtract every 5th column - microsoft.public.excel ... Excel Sum Functions -- Sum Excel Cells Use Excel SUM ... I want to add ... add a space after each text value ... Subtracting Two Tables - microsoft.public.excel.newusers ...Is it possible to easily subtract two tables and place the ... a7, after entering =f1-a1, that the little cross in the ... Same Tables (Current/Previous) in a Query / Sum is ... How to find set of numbers to sum nearest to a given total but not ...How to find set of numbers to sum nearest to a given ... I mean, > without any editing; just as shows after ... Subtract results from two queries? - microsoft.public ... how do I create a formula to add up time on a time sheet ...Also, is there a simple way to have my time results automatically subtract 1/2 hour ... time ... yyyy hh:mm:ss it should look ... time in the afternoon, I add the sum of ... Excel - Adding positive or negative numbers in a column ...=SUMIF(A1:A100,">0") will sum the poisitve values ... Excel :: Subtract Positive And Negative Numbers Sorting ... Blank records appearing after import from excel Query Running Balance - microsoft.public.access.queries ...No luck again it sum-up all sales & all purchase for each invoice but I want a ... I have no idea about it because im new to acces 2007. I just need to subtract t... totalling a group of worksheets - microsoft.public.excel.misc ...something like =sum(start!A3:end!A3) but this doesn't work ... I know it ... formula to subtract from inventory total - microsoft.public.excel ... Hello, I would ... microsoft.public.excel.worksheet.functions - page 31I would like to subtract the weekends and give me a total ... The ultimate goal is to rank each player after each ... How to sum by month Utf 8 116 I have a sales order ... Formula for daily/weekly hours worked - microsoft.public.access ...Sum function in report not working properly - microsoft.public ... This ... daily and weekly hourly totals? ... Col M: Net total weekly working hours after subtracting ... PIvot Table top Values - microsoft.public.excelIn the Pivot Field List-Values it is "Sum of" or ... ... Subtract colums in pivot table - microsoft.public.excel.misc ... ... After you have created a PivotTable report in the ... The results of subtraction is called...? What is it called ...The results of subtraction is called...? What is it called? ... Addition is sum, so is multiplication... in division it is quotient etc. hmmm ... Subtraction - Wikipedia, the free encyclopediaWe can view 7 − 3 = 4 as the sum of two terms: 7 and -3. This perspective allows us to apply to subtraction all of the familiar rules and nomenclature of addition. Subtract numbers - Excel - Office.comUse the minus sign operator or the SUM function to subtract numbers in Excel 2007. Terms Used in Equations — FactMonster.comTerms Used in Equations Here are the terms used in equations for addition, subtraction, multiplication, and division. These terms include augend, addend, sum ... Algebra Help - How to Add, Subtract, Multiply, and Divide Polynomials... made up from adding, subtracting ... can be written as a sum ... After you ... 6/11/2012 6:35:26 PM
|