Summing Given A Criteria

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is there a way to create a report or a query that will sum the values in the
field named "A" if the value in the field named "B" is Principal ?

Kind of like the "SUMIF" function in Excel.

Thank you in advance.
 
Create a query with an IIf statement in it:

IIf( = "Principal", [A], 0)

Sum on that statement.
 
Thank you. How do I "Sum on that statement" ?

Douglas J. Steele said:
Create a query with an IIf statement in it:

IIf( = "Principal", [A], 0)

Sum on that statement.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


carl said:
Is there a way to create a report or a query that will sum the values in
the
field named "A" if the value in the field named "B" is Principal ?

Kind of like the "SUMIF" function in Excel.

Thank you in advance.
 
carl said:
Thank you. How do I "Sum on that statement" ?

Turn on grouping in the query, then in the Total row under that
calculation, choose Sum.
 
Thank you. I am an Access novice. Can you show my the actual SQL to do this ?
Thanks.
 
Normally Access novices don't want to see SQL!

Try:

SELECT Sum(IIf( = "Principal", [A], 0)) AS TotalAmount
FROM MyTable
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top