I am able to calculate the monthly difference using dateif but not arrayformula
Example : Start Date: 5-Oct-2020
End date: 9-Jun-2021 month difference: using formula (DATEDIF(D3,E3 , "M")).
But I'm unable to use array formula to calculate as I wanted each row to be auto-calculated with dates.
Appreciate some help from Google experts!
Try
=ArrayFormula(IF(LEN(D3:D), DATEDIF(D3:D,E3:E, "M"),))
and see if that works?
References
Arrayformula()
How do arrayformulas work?
Related
I am trying to sum values using sumifs but I am getting an error. Went throught several website but I guess I don't have a good understanding of how SUMIF works.
Right now I have a sheet with a registry date(C), a price per weeek(G) and a end date(D).
I would want to calculate the earning every week.
So I created another sheet with every week of the year.
=SUMIFS(Clients!G2:G;A5;>=Clients!C2:C;A5;<=Clients!D2:D)
I am not using coma as a separator as my google sheet is not in english.
I am trying to sum the incomes if the date on the second sheet is between the starting date and the end date. But I keep getting errors and I don't really unerstand why.
Thanks
I found an formula which look to be working.
=SUMIFS(Clients!G2:G;Clients!C2:C;"<="&A5;Clients!D2:D;">="&A5)
I guess that it was not working because I was letting A5 to incremente.
Problem solved.
Thanks for your help.
Find out more here on Google's post about =SUMIFS().
Sample usage
SUMIFS(A1:A10, B1:B10, ">20")
SUMIFS(A1:A10, B1:B10, ">20", C1:C10, "<30")
SUMIFS(C1:C100, E1:E100, "Yes")
Syntax
SUMIFS(sum_range, criteria_range1, criterion1, [criteria_range2, criterion2, ...])
sum_range – The range to be summed.
criteria_range1 – The range to be checked against criterion1.
criterion1 – The pattern or test to apply to criteria_range1.
criteria_range2, criterion2, … (OPTIONAL) – Additional ranges and criteria to be checked.
I have a Spreadsheet with duration values in one column, and date values in another.
I want to sum duration values based on a particular day of the week... eg, in the example screenshot, the first and last dates are Friday. So I want a formula that would add the duration values from the corresponding cells... a total of 17:00
I've tried a formula like this. But this doesn't work.
=SUMIF(D:D, CHOOSE(WEEKDAY(DATE(),2), "Fri") , A:A)
You could try:
=sumproduct(weekday(A:A)=6,D:D)
try:
=TEXT(ARRAYFORMULA(SUMIF(WEEKDAY(A:A, 11), 5, D:D)), "[h]:mm")
Not sure if there is an easy way because I'm noob at Google Sheets, but try with array formula:
=ArrayFormula(SUMIF(D1:D3;WEEKDAY(A1:A3;2);5))
Using it as array formula, I got this:
Hope this helps
One approach to do this is the following:
In column E put the weekday values. Use WEEKDAY() function which depending on your setting will make Friday any integer between 1-7. If using default Friday will be "6".
Use the SUMIF() function. Eg.=sumif(E:E,"=6",D:D)
Make sure the cell where your SUMIF() formula resides, also has a duration number format.
Please see the data example in the image below...
I would like to sum the amounts separately by months and years.
How can I do this using SUMIF ?
My idea was very simple - to have formula for each month and for each year, like this:
=SUMIF(A1:A100,"2018-01-*",B1:B100)
=SUMIF(A1:A100,"2018-02-*",B1:B100)
=SUMIF(A1:A100,"2018-03-*",B1:B100)
..etc
=SUMIF(A1:A100,"2018-*",B1:B100)
=SUMIF(A1:A100,"2019-*",B1:B100)
..etc
But this formulas don't work. Something is wrong with the criterion.
So what am I doing wrong ? Am I using wildcards incorrectly ?
Example of data that I have
The problem here is that cells containing dates are special and cannot be compared to criterion like 2018-08-*.
The workaround is to use SUMIFS and then set each criterion with the DATE() function. Here is example for 2018-07:
=SUMIFS(B2:B100,A2:A100,">="&DATE(2018,7,1),A2:A100,"<"&DATE(2018,8,1))
You could use Query as in the image below (showing sum for 8th month - August):
By changing month(A)+1=8 you will have different months.
Code:
=QUERY(A1:B5;"select sum(B) where month(A)+1=8 label sum(B) ''";0)
Is that OK for you?
I've already seen a lot of topics about my problem, but I can't resolve it.
Actually, I don't understand what is wrong in my formula ?
=ArrayFormula(
IF(
ISBLANK(A6:A);;SUMIFS(
Sheet1!J:J;
Sheet1!K:K; ">="&A6:A;
Sheet1!K:K;"<="& EOMONTH(A6:A;0)
)
)
)
What I'm trying to do :
Each line is a month. I want to SUM all sales made between the first day on the month, and the last one.
If I don't use ArrayFormula, it works. I dont understand how to write this formula to work with ArrayFormula.
Thank you very much for your help !
Just adding this as an answer for you,
Instead of using an array formula, I believe a query would serve you better.
as google date-time syntax is tricky we first have to convert the date value into a text and parse it as "yyyy-mm-dd" we then wrap the EOMONTH to get the last day of the month.
so we use the following formula to get the sum of the months sales:
=query(A:B;"Select sum(B)
where A <= date '"&text(eomonth(E14;0);"yyyy-mm-dd")&"'
AND A >= date '"&text(E14;"yyyy-mm-dd")&"' label sum(B) '' ";0)
hopefully, this is what you were after, apologies for the delay was on the train!
https://docs.google.com/spreadsheets/d/1ygppZZCd4b_Y_HufLwLdcynHAsa3pn6z5YXb3Poc3vk/edit?usp=sharing
I'm trying to get this aggregate date comparison working, and I thought I understood the syntax, but it's clearly not working. Can anyone correct the formula for me?
I'm trying to sum up the amounts in column I, where the date in H is prior to the date in A
My formula is =SUMIF(H$2:H,H$2:H<A4, I$2:I)
Just a small error with your SUMIF syntax:
=SUMIF(H$2:H;"<"&A4;I$2:I)