Use Boolean Criteria in AVERAGEIF() - google-sheets

I've got a column of classifications of how diverse counties in the US are and a column of Democratic Party vote share in the 2016 election. The diversity categories are "Very Diverse", "Somewhat Diverse", and "Homogeneous"
I'm trying to calculate the average vote share for "Very Diverse" counties and average vote share for everywhere else (so the criteria needs to be one of "Somewhat Diverse" or "Homogeneous".
Here is what I tried:
=AVERAGEIF(raw_data!D:D,OR("Homogeneous","Somewhat Diverse"),raw_data!E:E)
I got the #DIV/0! error. Can anyone help me fix that formula please? Thank you in advance!

See if this works
=AVERAGE(filter(raw_data!E:E, regexmatch(raw_data!D:D,"Homogeneous|Somewhat Diverse")))

Related

How to find the Relationship of two different Data?

May I know if there is a way to use google sheet tools to find the relationship between two different data? For example: I have 50 respondents in Google Forms, 20 males and 30 females. There is one single-choice question, "Are you happy today?" Now, I want to find out the percentage (or number) of Males and Females who answered "Yes". Is this possible?
I tried counting manually but it took me a long time because there are many different questions. I hope that there is a command that can help me with this. Thanks in advance.
You may try something alike:
=BYROW(UNIQUE(FILTER(A2:A,A2:A<>"")),LAMBDA(z,{z,TO_PERCENT(COUNTIFS(A:A,z,B:B,"Yes")/COUNTIF(A:A,z))}))

Is there a way calculate multiple cell values based on multiple criteria in google sheet

I wish to calculate the total pages based on 2 other criteria, the year and language column.
For example,
how could I calculate the total EN page numbers from 2022?
or the total DE page numbers from 2023?
I have searched on the internet, and found interesting things about google sheet and excel functions: index, match, vlookup ...but i could not find example of what i could use, or maybe i'm just very new at this.
Could anyone please help me?
try:
=SUM(FILTER(H:H; G:G=2022; I:I="DE"))

Respond with an error if dates and names overlap with each other

I think my brain is going to explode. I must be thinking about this to much.
I'm trying to make a spreadsheet to keep track of apartments and cars for a construction project. We only have so many cars and so many apartments. Im trying to schedule subcontractors so they don't overlap with each others apartments and cars.
Here is the code I have so far...
=IF(ARRAYFORMULA(B:B)=Data!$A$1,IF(DATEVALUE(D17)>=DATEVALUE(D18),IF(DATEVALUE(E18)>=DATEVALUE(E17),"Ok","Overlap")"Ok","Overlap"),"")
Please see my spreadsheet here for a better example of what I am looking for.
https://docs.google.com/spreadsheets/d/17t_8nhKfu3vy3OpAWZ_6Ep5Xn-4kwo8Xo4E6WuYVbFY/edit?usp=sharing
Thank you so much in advance!!!
You can try the formula below and paste it on the H3 cell for example. Afterwards, you will have to drag it down the column such that all the entries are covered.
As for the formula, it makes use of IF and COUNTIFS in order to check the conditions:
=IF(COUNTIFS(B$3:B3,B3,D$3:D3,"<="&D3,E$3:E3,">="&D3)>1,"Date Overlap",IF(COUNTIFS(C$3:C3,C3,D$3:D3,"<="&D3,E$3:E3,">="&D3)>1,"Vehicle Overlap","Ok"))
Reference
COUNTIFS function;
IF function.

Simple frequency distribution chart or formula (Google Sheets)

Have used this forum to help solve a few spreadsheet issues in the past (so many thank for all the donated time and expertise).
Hoping the community can help with something that thought initially to be quite simple but I can't find the answer or solution anywhere.
I have a list of values and I want to create a frequency distribution list from this. I don't want to collect the data into ranges (i.e. histogram style) but I do need to know exactly how many instances there are of each value. Values in spreadsheet example below.
https://docs.google.com/spreadsheets/d/10gkP4DLA_k8yrbVdNEFmrDwKrg-B_t6BUkAmPNE2CpQ/edit#gid=0
I don't need the data presented in a graph but if a graph is the easiest way to collate this then that's fine as I will need to routinely do this calculation.
Many thanks.
db
A 'group by' query should do this:
=query(B3:B,"select B,count(B) where B is not null group by B label B 'Value'")

Sum durations if they meet a criteria? (Google sheets)

I'm trying to create a dynamic dashboard for staff to track the total amount of time they've worked for our program. They fill out a form with start/end time and denote if it's work that's eligible for our program to pay them for it. I'm building a dashboard where they can see how many extended hours they've racked up over the course of the school year because we have limits on how many hours they can earn.
I'm including an editable
copy of my spreadsheet to show what I've got so far... I'd like to add up any durations in column E that have a "Yes" in Column F (which is all of them at the moment) and have that sum sit in cell C5. But all I can get it to do is sum up to zero, and I can visibly see that it should be more than zero. I've tried changing the format of the cell(s) too, but it's still zero.
Any help or ideas are greatly appreciated! And I'm always trying to learn and improve, so if you know how to do this and don't mind explaining to me how the solution works, I'd also really appreciate that so that I can keep getting better at Sheets. :)
Thanks in advance!
This is because the numbers in column J (in Data sheet) are stored as text. Either enter them instantly as numbers or use the helper column where they are converted by the formula e.g. =VALUE(J1)
Played around with it enough that I got it finally!
=SUM(ARRAYFORMULA(if(C8:C="Yes",E8:E-D8:D,0)))
Thanks for helping me troubleshoot and think it through!

Resources