Sum column only of rows that match a condition (of another column) - google-sheets

I have a spreadsheet in Google with the following data:
**Status Amount**
Under Review $120.00
Delivered $50.00
Paid $320.00
Paid $110.00
Under Review $200.00
I want to sum all the column Amount, only but of only of those rows that has a Status on 'Delivered' or 'Paid'
With my example, the SUM should return $480.00.
I was trying with this formula, but it isn't working
=SUMIF(Column Amount,Status={"Delivered","Paid"},Column Amount)
Any ideas? Thanks a lot!

You can also use the following formula:
=SUM(QUERY(A2:B,"select sum(B) where A='Paid' or A='Delivered' group by A"))

One of your columns is incorrect, and you need to use the arrayformula function. Documentation here
=SUM(ARRAYFORMULA(SUMIF([status_column],{"Delivered","Paid"},[amount_column])))

Related

Query and sum in Google Sheet

Hello I need help in creating a formula with query and sum in google sheet
Here are the condition:
count of all(Column A= a certain number or a specific cell) and Column E=either of the states-up to 4 state
Hope someone can assist me on this.
try:
=QUERY(A2:E, "select E,sum(A) where A is not null group by E label sum(A)''")

How to sum up the number of times a name is mentioned?

I'm trying to make a Google sheets document right now - It's basically a roster for work. How can I create a cell in which I can display the amounts of shifts one person has worked?
In other words: What is the function to count the number of times a specific name is mentioned in the sheet?
Thank you very much!!
let's say names are in A column try:
=QUERY(A:A; "select A,count(A) where A is not null group by A label count(A)''")

Google Sheets sum rows with the same first cell value grouped by first row value

I have dynamic data for an online shop with sales by product, by week split into columns:
I want to create a header row of the unique weeks and summarise the total sales by product by week in a dynamic table using query and or array formula if possible. However, Arrays and Queries seem to be designed for data exclusively in columns so maybe I need to transpose it in some way? Any ideas?
you can do:
=QUERY(B2:E, "select B,C+D,E label C+D''", 0)
or:
=ARRAYFORMULA({IF(B99=C99, B100:B+C100:C, B100:B),
IF(C99=D99, C100:C+D100:D, C100:C),
IF(D99=E99, D100:D+E100:E, D100:D),
IF(E99=F99, E100:E+F100:F, E100:E)})
Okay, so I took my own advice and did a transpose to get the data into a state that Query can work with and then re-transposed it back to get the format I wanted. However, it's not exactly dynamic as I'd have to edit the formula if we added or took away any products.
=Transpose(query(transpose(A2:E13),"Select Col1, Sum(Col2), Sum (Col3), Sum(Col4), Sum(Col5), Sum(Col6) ,Sum(Col7), Sum(Col8), Sum(Col9), Sum(Col10), Sum(Col11), Sum(Col12) group by Col1",1))
Which produces a nice tabular result:
Any ideas how to make the formula more dynamic?

How to count # lates per student name?

sample attendance (google) sheet
I want count the number of total lates per student name on this sample sheet, e.g, how many lates Mary Love has (actual sheet has over 30,000 rows, 10 columns). If possible, this count needs to change as students have additional lates. I'd really appreciate any help someone might be able to provide. I thank you very much in advance.
In addition to previous post, a QUERY() function also seems a good option as it can output a 2D-array, containing the names and the counts in one formula (no need to drag down). As an example, try:
=query(A:G, "select A, count(B) where B ='Late' group by A ", 1)
If you want to limit the result tho those who had more then 3 late's, you can do:
=query(query(A:G, "select A, count(B) where B ='Late' group by A ", 1), "where Col2 > 3")
Also further filtering with date can be done very easily. However I think that may require some 'cleaning up' of the current data: I noticed a lot of different date formats in col D... :-)
For counting each of several students and to allow greater versatility I suggest a pivot table with Student Name for Rows, Late for Values with Summarise by: COUNTA and Late for Filter with Show: Late.
You can use the COUNTIFS function to get what you are looking for. This formula will count all matches for multiple criteria ranges and criteria (e.g. student name & late).
This is the syntax for the formula:
COUNTIFS(criteria_range1, criteria1, [criteria_range2, criteria2]…)
If you put Mary Love in cell I2, you could then put this in J2.
=countifs(B:B,"=late", A:A,I2)
Then as more rows are added it will automatically update the "lates". I would also suggest using named ranges, then you could replace B:B and A:A with the named range.
I would suggest using the =query function as documented below. If that doesn't meet your needs you could modify the above:
=if (countifs(B:B,"=Late", A:A,I2, D:D, ">="&N2) >= 3, "True", "False")
This will put "True" in the column if there are 3 or more lates, false if not. This will require you put the date you want to check against in column N2. Change N2 above if you want to use a different column.

Sum same values in different columns (Google Spreadsheet)

I've got two columns, A with the date and B with the revenue. Some dates are duplicated and I'd like to omit the duplicate dates and to sum the revenue values from the same date.
It would be something like bringing this:
12/04/2014 5$
12/04/2014 5$
13/04/2014 6$
13/04/2014 6$
to this:
12/04/2014 10$
13/04/2014 12$
You could use query to achieve this. If your data is in columns A & B with headers, you could use:
=Query($A$1:$B$5,"select A,sum(B) group by A", 1)
Here is a sample sheet.
You also can use:
=unique(A), this will return each date
=sum(filter(B:B,A=date_row), sum each time that date appears
I hope it works for you!
Regards

Resources