I am collecting stats for a small library.
I have people completing Google forms when they check out books. I have one field where they enter the call number for each book they borrow. These call numbers fall into three major classifications and take the following form (REF.XX.YYYY, FA.XX.YYYY, AA.XX.YYYY) where X and Y are a combination of letters and numerals.
The result in the spreadsheet would look something like this:
Table
Shared table
I am trying to come up with a way to count the number of instances each classification designation comes up (REF, FA, or AA) throughout the column. For instance, REF should be 3, FA should be 0 and AA should be 1. I made several tries with COUNTIF function but without any success. Any clue about what could be such formula?
The expected output is in red. I want to obtain such output using formulas.
Any help would be appreciated.
You can try getting those classifications using regexextract and then use a query to count everything.
=ArrayFormula(query({A2:A\regexextract(B2:B; "^[A-Z]*")}; "Select Col2, count(Col1) where Col2 <>'' group by Col2 label count(Col1) ''"))
I've added this formula to your table. AA is not showing up in the result because it is not present in the source data.
Related
I have two columns of text/abbreviations i want to summarize in a (or two respectively) tables.
Example:
Column 1: SiteScopeInput
Swap_G09+Remove_U21+Rollout_L07+Swap_L08+Swap_L18+Rollout_L21+Rollout_N35
Remove_U21+Rollout_L07+Swap_L08+Swap_L18+Rollout_L21+Rollout_N35
Swap_G09+Rollout_L07+Swap_L08+Swap_L09+Swap_L18+Rollout_L21+Swap_L26+Rollout_N35
Swap_G09+Remove_U21+Rollout_L07+Swap_L08+Swap_L18+Rollout_L21+Rollout_N35
Here I'd like to summarize how many times words occure - for example:
Swap_G09
Remove_U1
Rollout_L07
and so on.
I've tried a combination of
ArrayFormula, LEN and REGEXREPLACE
but my beginner mind can't wrap around this task.
Any tips? Thanks!
If you want to treat Swap_G09 etc. as a separate word, then a combination of split, flatten and query should do it:
=ArrayFormula(query(FLATTEN(split(filter(A:A,A:A<>""),"+")),"select Col1,count(Col1) where Col1 is not null group by Col1 label Col1 'Word'"))
This might be something fairly simple but struggling to find a way to do it.
In Column B, I have a list of foods required.
In Column C, I have the amount needed.
In Column D, I have g (for grams) ml (for mills) etc.
I would like to combine the duplicates in Column B and update the totals from Column C, with the g or ml in Column D beside it.
The list I have has been created by using an array formula based on dropdowns in another sheet.
I have seen people using UNIQUE formula in 1 column (this works) and then a SUMIF formula in another column and then a JOIN formula in another... I tried this but the SUMIF is always returning 0.
Would someone please be able to advise on how I can do this?
TIA :D
It's hard to be sure exactly what you need without seeing the data. But based on my understanding of solely what you've posted, this QUERY formula should generate a condensed mini-report:
=QUERY({B2:D},"Select Col1, SUM(Col2), Col3 WHERE Col1 Is Not Null GROUP BY Col1, Col3 LABEL SUM(Col2) ''")
In plain English, this means "Arrange the data from the range B2:D in the same order as the raw data, but sum the second column's data according to matches in both the first and third columns. Only return results for the raw data where the first column is not blank. Replace the default 'sum' header on the second column with nothing; I don't need it."
This formula assumes that every ingredient will always be attached to the same measurement (e.g., 'salt' in Col B is always paired with 'mg' in Col D, etc.). If this is not the case, you will wind up with ingredients being listed as many times as there are different measures in Col D.
I am using a query formula to import data from a different sheet.
However after querying the data, I got the same code which I need to sum the episode and the value with unique formula therefore after querying only show unique code. I'm not sure how to mix the formula.
My query formula is the following:
=QUERY(Paste!A:M,"SELECT A,B,C ORDER BY C DESC LIMIT 15")
My spreadsheet link is the following:
https://docs.google.com/spreadsheets/d/1A6lGIlU147Y_0WFD7Btkq4IMuY-Z3D1HsNiTgjLjm0o/edit?usp=sharing
As above image. Under column A I have same code for FMEM1 due to my raw data separate it for some reason. I don't want the same code separated. I want unique code not separated and sum the episode and sum the value
try
=query({A3:A17,B3:B17,C3:C17},"select Col1, Sum(Col2),Sum(Col3) group by Col1 label Col1 'Code',Sum(Col2) 'Total Episode',Sum(Col3) 'Total Value'")
Screenshot
The full google spread sheet system is used for score keeping and is prone to delays when updating, however I have never run into an issue like this were the same basic function is returning two separate results. The problem is repeatable and occurs on more than one spreadsheet.
I have created a test sheet-
https://docs.google.com/spreadsheets/d/1arh0D9ch5MpQjRh_bHjLfLx5S7TAW8R_pgGLf5tovig/
with the code in question; Can anyone help please?
=QUERY(IMPORTRANGE("***","***"),"select Col1 where Col1 <>5 order by Col9 desc")
in your QUERY formula you are selecting cells that are numeric and comparing it to <>5 but take a notice that A2 is not numeric:
that is the reason why 2 2 is not included in your C column
also it looks like that your QUERY formula smashed first cells into one because you did not specify the 3td query parameter. try:
=QUERY(IMPORTRANGE("1pnowvo6YVj-DZAPCaKE2x9vSIbpAAmlwhRMO2OZNlrE","color!A84:M115"),
"select Col1 where Col1 <>5 order by Col9 desc", 0)
I am trying to find the third most frequent value in a google sheet. I saw how to find the second and first one, but I can't find out how to find the third and up. I need to know how to calculate the third, fourth, fifth, sixth, seventh, and eighth places. I am working on a leaderboard system for the school I work at.
I know this is how to find the second most frequent:
=ArrayFormula(MODE(IF((F1:F85=MODE(F1:F85)),"",F1:F85)))
and this is how to find the first:
=mode(F1:F65)
I need to find all the ones that come after that, though.
I need to find all the ones that come after that, though.
The more scalable solution that avoids nested IFs would be something along the lines of:
=ArrayFormula(QUERY({F1:F85,LEN(F1:F85)},"select Col1, count(Col2) where Col2 > 0 group by Col1 order by count(Col2) desc",0))
This produces a table of each number and their associated frequency, sorted from most frequent to least. You can retrieve the specific value from this table using INDEX:
=INDEX(QUERY({F1:F85,LEN(F1:F85)},"select Col1, count(Col2) where Col2 > 0 group by Col1 order by count(Col2) desc",0),n+1,1)
where n is the position you require (1 = most frequent, 2 = second-most frequent, etc).
Your initial This question was referring to a 2-dimensional range, which will be a bit more complicated, but still doable.
Given B1:B99 as our range, if A1 is most common, A2 is second most common, et cetera:
A1 = ArrayFormula(MODE(B1:B99))
A2 = ArrayFormula(MODE(IF((B1:B99=A1),"",B1:B99)))
A3 = ArrayFormula(MODE(IF((B1:B99=A1),"",(IF((B1:B99=A2),"",B1:B99)))))
A4 = ArrayFormula(MODE(IF((B1:B99=A1),"",(IF((B1:B99=A2),"",(IF((B1:B99=A3),"",B1:B99)))))))
I'm curious if anyone has a better solution though.
I'm pretty sure there is a more elegant solution to this than the other answers give.
Try using this Google Visualization API Query:
=query(A:B,"select A, count(B) group by A order by count(B) desc label count(B) 'Count' ",1)
This should give you 2 columns – the first gives the distinct values in your Column A, the second gives the number of occurrences for each value (sorted in descending order).
You should note that it seems that queries on single columns aren't supported, so I admit that the query is a little messy (although it should work if you just keep the B column empty).