How to split sum by month? in googlesheets? - google-sheets

Hello, please help me
How to split sum by month? in googlesheets ?

Try:
Formula in J3:
=INDEX(QUERY({TEXT(B3:B,"YYYY-MM"),H3:H},"Select Col1, sum(Col2) where Col2>0 group by Col1 label Col1 'month'"))

Use this formula
= ArrayFormula(
{ TEXT(DATE(YEAR(TODAY());UNIQUE(MONTH(A3:A));DAY(TODAY())); "mmmm yyyy")\ IF(SUMIF(MONTH(A3:A); UNIQUE(MONTH(A3:A));H3:H)=0;;TEXT(SUMIF(MONTH(A3:A); UNIQUE(MONTH(A3:A)); H3:H); "Rp#,###"))})

Formula:
=ARRAYFORMULA(SUMIF(MONTH(A3:A); UNIQUE(MONTH(A3:A)); H3:H))
Explanation:
MONTH(A3:A) extracts the month from the dates in column A
UNIQUE(MONTH(A3:A)) finds the unique months from this list
SUMIF() takes the month of each row as the range for the summation, the list of unique months as the criteria, and then the total values H3:H as the range to sum.
ARRAYFORMULA() expands it to all rows below

Use QUERY() function with date columns so that we can sort if needed. Use EOMONTH() to make group by month.
=QUERY({INDEX(IF(B2:B="",,EOMONTH(B2:B,0))),E2:E},"select Col1,sum(Col2)
where Col1 is not null
group by Col1
label Col1 'Month', sum(Col2) 'Total'
format Col1 'MMM-YYYY'")

Related

How to get month wise sum of data in a table

I have date in one column and data in another from jan 2017 to Dec 2022.
I want to find sum of data month wise.
attaching file. Currently doing it manually. Any work around, array or something. Help.
You can try with a QUERY like this:
=QUERY({INDEX(EOMONTH(A:A,0)),C:C},"SELECT Col1,Sum(Col2) where Col2 is not null group by Col1 format Col1 'MMM-YYYY'",1)
within sheets you can try:
=QUERY({INDEX(IF(LEN(A9:A),EOMONTH(A9:A,),)),C9:C},"SELECT Col1, SUM(Col2) Where Col1 IS NOT NULL GROUP BY Col1 LABEL SUM(Col2) '' FORMAT Col1 'MMM YY'")

Max Sum of row within date range - Google Sheets

I am using Google Sheets.
I have names in first column, dates in first row, and numbers for each name/date.
I want to return the name and sum of numbers for the person who's sum of numbers is the largest (within date range.)
A cell formula for this would be better than a script.
It sounds straight forward but am going in circles and would appreciate help. Thanks Newman
Thank you.
try:
=INDEX(QUERY(SPLIT(FLATTEN(A3:A&"♦"&FILTER(B3:F, B2:F2>="2021-10-07"*1, B2:F2<="2021-10-13"*1)), "♦"),
"select Col1,sum(Col2) where Col2 is not null group by Col1 order by sum(Col2) desc label sum(Col2)''"))
and for just 1 record:
=INDEX(QUERY(QUERY(SPLIT(FLATTEN(A3:A&"♦"&FILTER(B3:F, B2:F2>="2021-10-07"*1, B2:F2<="2021-10-13"*1)), "♦"),
"select Col1,sum(Col2) where Col2 is not null group by Col1 order by sum(Col2) desc label sum(Col2)''"), "limit 1", 0)

I want to sum value of of third column based on other two columns value in google sheets and col1 and col2 contains multiple duplicate values

https://docs.google.com/spreadsheets/d/1_MeiySJHI8OD84BPDOj_z57My-TXbs2ey4AOkQP3zug/edit?usp=sharing
I am sharing the link of sheet on which I want solution on that sheet also I have tried to explain you the question.
I have three columns I want sum of third col3 value based on first two column value
if col1 = 2 and col2 = 40; Then I should get the sum of all value in col3 in which col1 = 2 and col2 = 40
if the col1 contains value of 2 and col2 contains 40 than sum of col3 value only those col3 value in which col1=2 and col2=40
so if any of the column value changes than sum of col3 also sum according to that.
use:
={"result"; INDEX(IF(COUNTIFS(A2:A&" "&B2:B, A2:A&" "&B2:B, ROW(A2:A), "<="&ROW(A2:A))=1,
IFNA(VLOOKUP(A2:A&" "&B2:B,
QUERY({A2:A&" "&B2:B, C2:C},
"select Col1,sum(Col2) where Col1 is not null group by Col1 label sum(Col2)''"), 2, 0)), ))}
In cell K4 I entered
={"Result Col"; ArrayFormula(if(len(G5:G),if(match(G5:G&H5:H,G5:G&H5:H,0)+4=row(G5:G),sumif(G5:G&H5:H,G5:G&H5:H,I5:I),),))}
I used the same formula (with different range) in E1 (for what I assume to be your 'real' data).
See if that helps?
The simpliest solution is to use a pivot table, see inside your spreadsheet. If you want the total inside the original data, and take advantage of this simple solution, you can then recall the total by GETPIVOTDATA

how to find the count of peoples according to the date

here I want to know can we find the total peoples present on that specified date? that if we enter the date on the next sheet we need to display the count of peoples present on that day. An example is there on the sheet 2.
https://docs.google.com/spreadsheets/d/1TxScKc0NT2pB9ytpyMcq99nYmirS5NAPnRGNtACyaeE/edit#gid=0
thanks in advance
use:
=QUERY({Sheet1!A2:B},
"select Col1,count(Col2) where Col2 is not null group by Col1 label count(Col2)''")
update:
=ARRAYFORMULA(IFNA(VLOOKUP(A2:A, QUERY({Sheet1!A2:B},
"select Col1,count(Col2) where Col2 is not null
group by Col1 label count(Col2)''"), 2, 0)))

How to sum values for each day in google sheets

I want to make two columns one that has date and the other that has sum for the number of violations occurred on that day. Have a look at the data below.
use:
=QUERY({B:C}; "select Col1,sum(Col2) where Col1 is not null group by Col1 label sum(Col1)''")

Resources