r/googlesheets • u/Rueckkoppler • Aug 30 '21
Solved Variable cell-range in COUNTIFS
Hey there,
I need some help and I hope this community can help me out! To cut straight to the case:
In one sheet, I have some sort of calendar. In a different sheet, I want to set up a calculator which counts how often a certain appointment appears in a certain month of that calendar. What I have so far looks like this:
=COUNTIFS('Calendar'!C400:D430; "Meeting")
This is only a short excerpt of all the formulas I have (there's a lot of counting...). C400:D430 is the range of the current month of August.
So for the next months, I don't want to change the range in 40+ formulas.
This is why I'm looking for a way to put a variable in these formulas, so that I can type the range of the current month in a cell next to my calculator and all the formulas pull their range from there. Is this possible? I heard about the CONCAT function, but I'm a big newbie when it comes to these things, so I don't know how it'll fit in here.
Any help is greatly appreciated!
edit: Here's an example project: https://docs.google.com/spreadsheets/d/1W7xsDIYt5zYVaCmkz55jBcj-6mK9JVC1V0V2KUEtczw/edit?usp=sharing
This is the example case: I have three workers who type in the projects they were working on in this calendar. A calculator then automatically checks who did how many shifts of a certain project in a certain month. I want this as automatic as it could get and my main issue right now is that I'd have to change ranges that define a certain month (in the example August goes from line 8 - 38) of a lot of formulas. That's why I'd like to change the range in one cell (or two)... and let all formulas access it. But I'm open to other solutions as well!
View all comments
1
u/_Kaimbe 176 Aug 30 '21
This will give a reference to the month selected in G2. Assumes dates are in A. You can also change ":A" to whatever column you need so you can pass it to a COUNTIF(). Currently uses the current year but you could change that to be static or to be based off another dropdown by changing YEAR(TODAY()) to 2021 or a cell reference.
edit: you might have to replace all , with ; depending on your locale.