Google Sheets / COUNTIF value is X and date is TODAY - google-sheets

I have a long list of dates in column C with a long list of names in column D.
I need to count how many times a certain name is mentioned but only if the date next to it is today.
So if today's date is 16/11/2022, and I want to find the name "Peter", this formula should return "2".
Column C
Column D
16/11/2022
Peter
16/11/2022
Peter
17/11/2022
Peter
Any ideas? Thanks!

use:
=COUNTIFS(C:C; TODAY(); D:D; "Peter")
update:
=INDEX(COUNTIFS(INT(C:C), TODAY(), D:D, "Peter"))

Related

Sum range by month in Google Sheets with date conditional

I have a sheet with these columns:
A (Date): Range of dates for the year
B (Amount): An amount for an expense
D (Month): Name of each month in the year (e.g. June, July, etc)
I've tried this as suggested to work in other posts:
=SUMPRODUCT(B:B, ISDATE(A:A)*MONTH(A:A)=MONTH(D3&1))
I get the error Function MONTH parameter 1 expects number values. But 'Date' is a text and cannot be coerced to a number. with this.
If I remove the header, I just get a 0 for the sum for each month, which is incorrect.
How do I get this to work for each month the way my sheet is setup?
What the sheet currently looks like:
https://docs.google.com/spreadsheets/d/1_8DQTa9aXGjvd7twL6RZMcFyqxa4Sg7eVTcD2wDXH2A/edit?usp=sharing
Try this instead. Not sure where you got that other formula:
=SUMPRODUCT(B:B,TEXT(A:A,"mmmm")=D3)
use:
=ARRAYFORMULA(IFNA(VLOOKUP(MONTH(D3:D10&1),
QUERY(A2:B, "select month(A)+1,sum(B) group by month(A)"), 2, )))
Use this
=IF(D3="",,IFERROR(SUM(FILTER($B$2:$B,MONTH($A$2:$A&1)=MONTH(D3&1))),""))

Total Sum With Vlookup

I have two spreadsheets with names and times. One is specific session times and on the second sheet, I want to sum up the total times based on each instance from sheet one.
Sheet 1: Session Time
Name | Time
David 5
Mike 2
Daniel 3
David 2
Daniel 8
Sheet 2: Total Time (The one for which I need a forumula)
Name | Total Time
David 7
Mike 2
Daniel 11
I tried a countif and vlookup but I couldn't get it match more than one instance of the name on sheet 1. I also tried this suggested formual from a suggested post but its not summing a second instance of the user name
=ARRAYFORMULA(SUM(ifna(VLOOKUP(A2, 'Sheet 1'!A3:AA16, 5, false))))
A2 = David (On Sheet 2)
Sheet 1'!A3:AA16 = List of names in columns A and all the way to AA is a series of columns with numerical values
5 = the column number from with I want to return the sum for every instance of David (2 in this example with a total of 7)
False = its not sorted
Any help is mucho appriciado!
You can use this formula in your Sheet2!B1:
={"Total Time";arrayformula(if(A2:A<>"",sumif(Sheet1!A1:A,A2:A,Sheet1!B1:B),""))}
Or simply use =arrayformula(if(A2:A<>"",sumif(Sheet1!A1:A,A2:A,Sheet1!B1:B),"")) in Sheet2!B2
Get the sum of the range based on a specific criteria using SUMIF()
Basically, get the sum of Sheet1!B1:B if Sheet1!A1:A matches the current cell being checked in arrayformula A2:A
Output:
This can be accomplished with a simple QUERY, e.g.,
=QUERY('Session Time'!A:B, "Select A, SUM(B) WHERE A Is Not Null GROUP BY A LABEL SUM(B) 'Total Time'")

Need help creating a formula for dynamic average of last 4 weeks expenses

I am looking to create a spreadsheet that my staff fill out, it then gives me a master sheet with all the data, then I import dynamically to my financial spreadsheet telling me the average cost of my client over the last 30 days.
I am looking to create an AVERAGE formula of the last 30 days when Date = Today (Monday) (I want the weekday Monday as that's when staff hand in invoices)
Hope this makes sense, it's really tough!
Here's a video of me explaining my desired outcome
https://www.loom.com/share/3a9cb75052b246d1af2ba2f9ce9180a7
I've followed several guides & can't figure it out.
=ArrayFormula(iferror(query(average(if(today() - weekday(today(),3)-30)))))
I expected $90 average and I just get blank
You could use this formula:
=AVERAGE(VLOOKUP(TODAY()-WEEKDAY(TODAY(),2)+1,A:H,2,FALSE),VLOOKUP(TODAY()-WEEKDAY(TODAY(),2)-6,A:H,2,FALSE),VLOOKUP(TODAY()-WEEKDAY(TODAY(),2)-13,A:H,2,FALSE),VLOOKUP(TODAY()-WEEKDAY(TODAY(),2)-20,A:H,2,FALSE))
To break it down in to its component parts, the AVERAGE is taken from VLOOKUP results:
VLOOKUP(TODAY()-WEEKDAY(TODAY(),2)+1,A:H,2,FALSE)
The VLOOKUP is looking for the last Monday from the current date:
TODAY()-WEEKDAY(TODAY(),2)+1
Then
TODAY()-WEEKDAY(TODAY(),2)-6
and so on...
When using on your sheet, you will have to specify the column you want to reference in your look up, for colunm B (brand1) use: A:H,2,FALSE), for colunm C (brand2) use: A:H,3,FALSE), for colunm d (brand3) use: A:H,4,FALSE) and so on...
=INDEX(QUERY({INDIRECT("A2:D"&ROW()-1)},
"select avg(Col2),avg(Col3),avg(Col4)
where Col1 <= date '"&TEXT(TODAY(), "yyyy-MM-dd")&"'
and Col1 >= date '"&TEXT(TODAY()-30, "yyyy-MM-dd")&"'"), 2, )

Count Number of Each Month in Column of dates in Google Spreadsheet

I have a Google sheet with a column of dates. I would like to get a total for each month, so that I can see how many of the dates are January, February, March, etc. This formula does not work (Dates is the name of range):
=COUNTIF(Dates,Month=1)
Any help is appreciated.
Following the logic of your proposition, the error is that MONTH() returns an integer, not an array. You can add ARRAYFORMULA() to do the job :
=COUNTIF( ARRAYFORMULA( MONTH( Dates ) ), "=2" )
I finally devised the correct search term for Google help
=sumproduct(month(Dates)=2)

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