I have this data set (example)
It shows different responses for different towns and what industries the respondent thinks has job openings (e.g Akron has 2 rows (2 respondents), with different industries given)
Now I want to chart/gather from that data set, the count of each industry for each town: So using this table setup, I want a formula that shows, for example, how many times "restaurant" was listed for Akron...
So here's what I want a formula to give me, in cell B63, ("Akron" row, "restaurant" column) for ex. This is paraphrasing in plain English what I want it to do. I have tried countless variations of COUNTIFS, IFS, MATCH, SUM, INDIRECT, LOOKUPS... etc and have not been able to get the numbers that reflect the data given.
=count if ("restaurant" appears in the range B53:D60 AND if those occurrences are in rows starting with "Akron" (in the range A53:A60))
The main hang-up, obviously is that these 2 different criteria encompass 2 different sized ranges (not something countifs like...) So how can I get around that barrier?
A final note: the imgs/ex given are small representations of a much larger range that I'm actually working on... so yes, I could make a nifty formula for each town that has just the town rows as my range...(COUNTIF likes this approach!) but I've got many more towns of various row counts... it takes too long to make a town specific range or diff formula for each town... I prefer 1 formula that looks through all the town rows/range and all the "Industries" range...
=COUNTIF(FILTER(DATA_RANGE,TOWN_NAME="TARGET_TOWN_NAME"),"=TARGET_INDUSTRY")
Example use
=COUNTIF(FILTER(A2:C,A2:A="A"),"=1")
Counts the responses of 1 under town A.
Example Screengrab
Related
I am trying to find a formula that will give me the count of unique dates a persons' name appears in one of two different columns and/or both columns.
I have a set of data where a person's name may show up in a "driver" column or a "helper" column, multiple times over the course of one day. Throughout the day some drivers might also be helpers and some days a driver may come in for duty but only as a helper. Basically all drivers can be helpers, but not all helpers can be drivers.
I've attached a link to a sample sheet for more clarity.
https://docs.google.com/spreadsheets/d/1GqNa1hrViX4B6mkL3wWcqEsy87gmdw77DhkhIaswLyI/edit?usp=sharing
I've created a REPORTS tab with a SORT(UNIQUE(FLATTEN)) Formula to give me a list of the names that appear in the DATA Tab.
I'm looking for a way to count the unique dates a name from the name (Column A of the REPORTS Tab) appears in either of the two columns (Column B and/or C of the DATA Tab) to determine the total number of days worked so I can calculate the total number of days off over the range queried.
I've tried several iterations of countif, countunique, and countuniqueifs but cannot seem to find a way to return the correct values.
Any advice on how to make this work would be appreciated.
I think if you put this formula in cell b7 you'll be set. You can drag it down.
=Counta(Unique(filter(DATA!A:A,(DATA!C:C=A7)+(DATA!B:B=A7))))
Here's a working version of your file.
For anyone interested, Google Sheets' Filter function differs slightly from Excel's Filter function because Sheets attempts to make it easier for users to apply multiple conditions by simply separating each parameter with a comma. Example: =filter(A:A,A:A<>"",B:B<>"bad result") will provide different results between the Sheets and Excel.
Excel Filter requires users to specify multiple conditions within parenthesis and denote each criterion be flagged with an OR condition with a + else an AND condition with a multiplication sign *. While this can appear daunting and bizarre to multiply arrays that have text in it, it allows for more flexibility.
To Google's credit, if one follows the required Excel Syntax (as I did in this answer) then the functions will behave the same.
delete what you got and use:
=QUERY(QUERY(UNIQUE({DATA!A:B; DATA!A:A, DATA!C:C}),
"select Col2,count(Col1),"&D2&"-count(Col2)
where Col2 is not null
group by Col2"),
"offset 1", 0)
I am trying to join gained level for names in a list.
Some names are the same person who has changed handle and the scores should be summed.
I have created a sheet to track levels for players in rankings over time.
My implementation is not as clever as I would like it to be.
Also, there is a problem with some players changing names.
Example Sheet
Currently, I have
=SORT(UNIQUE({}))
In order to produce just one of each name in a list
In the cell next to that I'm using
=IFERROR(INDEX(MATCH())) + IFERROR(INDEX(MATCH())) + IFERROR(INDEX(MATCH()))
to the sum of levels for each name across several ranges /sessions.
In the example sheet, N7 and N10 is the same person but my SORT, INDEX, as well as QUERY cannot handle this. I would like to (manually type in the names as strings that belong to the same person) and that the latest handle is the one used in query output together with the sum of all gains.
Any direction pointers or suggestions as to how I could improve my current implementation or even solve the problem I'm having would be appreciated.
=ARRAYFORMULA(QUERY({Ranking!CF4:CF200\ SUBSTITUTE(Ranking!CG4:CG200; "N7"; "N10")};
"select Col2,sum(Col1)
where Col2 is not null
group by Col2
label sum(Col1)'',Col2'Total levels gained since 15 April 2018'"; 0))
Might not suit you (could mean an extra column per month) but one way would be to to use a lookup table. That is enter whatever name suits you, lookup the 'standard' for that name and drive further analysis off that.
Have a sheet with items which have data attributes, and may be used for multiple purposes.
There is a lookup table to lookup a score, based on the attributes.
So I can get the score for each item, see the top right section, and then sum that for each of the purposes. So purpose 1 has 11 data attribute points etc.
The score formula is included in the image for reference.
However, rather than copy all the data and score it, ideally would like a formula that can just go into a scoring column. Otherwise, with say 200 items, I need to have 201 columns just to score this one thing...
However, sumifs and sumif won't do this. What I really want is a "sum(foreach cell in range, do this formula)"
Does anyone know how this might be done?
Just on this mini example, you could use
=ArrayFormula(sum(if(C4:E4="yes",vlookup(C$2:E$2,$B$9:$D$11,match(C$3:E$3,$C$8:$D$8,0)+1,false))))
so you do a lookup on attribute 2 to find which column to do the lookup on attribute 1.
That's about as clear as I make what I'm trying to do in Google Sheets.
Here's a sample table with two tabs.
Tab 1
Basically, I've got a table fed from a form. One column has names of say 50 various people. The names repeat randomly.
Other columns contain comments that each person made.
Tab 2
Here is essentially a heat map of keywords used by the different people. Column A are the keywords, while row 1 contains the keywords I'm interested in.
Each cell in this grid should (1) search tab 1 for all instances of each name, then (2) count the number of times the keyword appears in all of that person's comments.
Countifs doesn't work because the array arguments are different sizes.
I can't figure out how to phrase a filter embedded in a countif.
And using QUERY seems like it will cause trouble because my actual spreadsheet is something like 100 names and 40 keywords.
I'm open to suggestions and grateful for your help!
ken.
In B2 try
=sum(ArrayFormula(--regexmatch(filter(Sheet1!$B$2:$F, Sheet1!$A$2:$A=B$1), "\b"&$A2&"\b")))
Then fill down to the right and down as far as needed.
To make the match case-insensitive, change "\b"&$A2&"\b" to
"\b(?i)"&$A2&"\b"
See if that works?
I have a simple table with 3 columns:
[Name] [Score] [Rank]
For the 3rd column, I'm using the following formula to rank each row according to the score:
=RANK(C9,$C$9:$C$28,0)
The problem is that the formula isn't returning the values I'd expect. For example on the last row it returns 19 when it should be 5.
I found other formulas for ranking (RANK.EQ, etc.) but same issue happens.
Here is the Google Sheet to see it in context:
https://docs.google.com/spreadsheets/d/1P1m7UHPPIcQLQkzpnk-SI1y7-0mhKytCWDjA6FJzFrM/edit?usp=sharing
Any guidance appreciated
The results you want can be achieved with a simple MATCH formula:
=match(round(C9,0),NamedRange1,0)
Provided an array (named NamedRange1 for above) is created, say with:
=sort(unique(round(C9:C28,0)),1,0)
I think the result is as intended. Check this Ranking Wikipedia page (called 'standard competition ranking'). It says:
Standard competition ranking ("1224" ranking)
In competition ranking, items that compare equal receive the same
ranking number, and then a gap is left in the ranking numbers. The
number of ranking numbers that are left out in this gap is one less
than the number of items that compared equal. Equivalently, each
item's ranking number is 1 plus the number of items ranked above it.
This ranking strategy is frequently adopted for competitions, as it
means that if two (or more) competitors tie for a position in the
ranking, the position of all those ranked below them is unaffected
(i.e., a competitor only comes second if exactly one person scores
better than them, third if exactly two people score better than them,
fourth if exactly three people score better than them, etc.).
Thus if A ranks ahead of B and C (which compare equal) which are both
ranked ahead of D, then A gets ranking number 1 ("first"), B gets
ranking number 2 ("joint second"), C also gets ranking number 2
("joint second") and D gets ranking number 4 ("fourth").
What you want is 'dense ranking' and it can be achieved by pnuts's answer or something like this:
set G9 to 1
set G10 to =if(round(C10,0)<round(C9,0), G9+1, G9)
copy G10 and paste it into G11:G28
Sample sheet is here.
Thanks to #pnuts and #sangboklee for your solutions. I think I have a good solution now. It is pnuts's solution, just simplified:
=match(round($C9,0),sort(unique(round($C$9:$C$28,0)),1,false),0)
This essentially "embeds" the created array within a single formula, that can be applied to all rows. And as a bonus, the values don't even have to be sorted.
Please check for correctness folks, but I think this works. I've updated the linked Google Sheet from the original question description (it's "Solution 2b").