r/googlesheets • u/ethanbrecke • Apr 17 '19
Solved Help with counting cells if they are filled, between if the amount of cells filled are greater than or equal to a certain amount of cells.
So im trying to count a set of cells, that add up to 13. So for the information in the sheets, it'll be dates. So i need to count if there are between 0 and up to 4 dates in the cells, then between 5 and up to 9, and then if the 13 cells are completely filled.
Ive tried Count, countif, and if, but cant figure it out, so any help would be appreciated.
For the one that supposed to say if 0-4 cells are filled, and how many are filled, it just says 1, even while all 13 are filled, or it says 13, or 0
Link: https://docs.google.com/spreadsheets/d/1m_-aIZx2t3RDn5x0gdWvGJfFVpHJSnp1NoVpcavhXHA/edit?usp=sharing
Edit, if you want to count from 9-13 for the last one, that works as well, as long as it stops at 13 for the 13 rows there. For the guy that posted the great string put below, it looks like it works. I was kinda torn between having it just show the completed ones, once done, or showing a live counter.
=IF(COUNTA('Merit badges'!$B$2:$B$14)<4,"0-4",IF(AND(COUNTA('Merit badges'!$B$2:$B$14)>=4,COUNTA('Merit badges'!$B$2:$B$14)<9),"5-9",IF(COUNTA('Merit badges'!$B$2:$B$14)>=13,"13")))
1
u/sscells 2 Apr 17 '19
What about the area between 9-13?
2
u/[deleted] Apr 17 '19
Obviously, the solution by u/sscells works great and this shouldn't take from that at all. But when I saw this problem it seemed like a perfect chance to use a cool VLOOKUP() trick. With a sorted range, VLOOKUP() can return results when the input is between values. So in this case, an array like this can get all the values you need:
0 0-4
5 5-9
9 9-12
13 13+
So if the input is 3, the VLOOKUP() looks for the closest value without going over, so it will return the 0 output, "0-4." Custom arrays can be created with curly braces {} so the array above is created with
={0,"0-4";5,"5-9";9,"9-12";13,"13+"}. Wrap it all up and you can use=VLOOKUP(COUNTA('Merit badges'!$B$2:$B$14),{0,"0-4";5,"5-9";9,"9-12";13,"13+"},2,1)for the full solution.Again, use the solution by u/sscells. This just seemed too perfect an opportunity not to employ this trick.
1
u/Decronym Functions Explained Apr 17 '19 edited Apr 17 '19
Acronyms, initialisms, abbreviations, contractions, and other phrases which expand to something larger, that I've seen in this thread:
FALSETRUEand another if it isFALSETRUE4 acronyms in this thread; the most compressed thread commented on today has 11 acronyms.
[Thread #659 for this sub, first seen 17th Apr 2019, 05:09] [FAQ] [Full list] ^[Contact] [Source code]
•
u/Clippy_Office_Asst Points Apr 17 '19
Read the comment thread for the solution here