0
I am trying to create the Range of a CountIf formula, using formulas. I found some data on using INDIRECT, but it doesn't seem to fit the bill. Here is the specific problem:
SHEET 1:
A B C D
1 Jan Feb Mar
2 Bob 2 0 1
3 Jane
4 Joe
SHEET 2:
A B C D
1 Blue Green Red
2 Bob Jan Jan Mar
3 Jane
4 Joe
I am trying to make a formula in Sheet 1 (cells B2, C2, D2, etc.) that will look up the name in the first column (take "Bob" for example), find the name in Sheet 2 column A, (i.e. find "Bob") and count all the cells in Bob's row that contain the name in 1st Row of Sheet 1 (Jan in the base of B1).
I tried different ways of using Vlookup and Indirect to feed a Range into the CountIf function.
Any ideas how to give a range into CountIf based on looking up a reference cell?
1You're visualizing a particular approach, and the example probably seems adequate to illustrate that. But there are a lot of ways to accomplish your objective, and the example and explanation are too ambiguous for people to provide a good answer. Can you better explain the actual problem and what the expected result would be? In your example, it isn't clear how countif would apply to that, or what the variable range would be. For example, it looks like every row has a value in each column, so a solution could be to simply give the number of data columns. (cont'd) – fixer1234 – 2019-04-10T07:20:17.980
You can use indirect to define a data range, but you say that isn't what you need. – fixer1234 – 2019-04-10T07:20:23.193
Sorry for the ambiguity. What I am trying to accomplish is having a count of times a certain month comes up in each row in Sheet 2. So for instance, in Bob's row in sheet 2, Jan comes up 2 times. In sheet 1 I have a column for each month, so Bob/Jan cell should have a formula that calculates to 2. Also Sheet 2 may get sorted from time to time. So the calculation is sheet 1 needs to reference the row in sheet based on the name entered in the cell. – bhinojosa – 2019-04-10T17:23:57.073
But that's just counting based on a criterion (=Jan). That has nothing to do with setting or adjusting the range used. The range is where you look to find and count qualifying items. – fixer1234 – 2019-04-10T17:36:28.003
Where the range comes in is: In cell B2 (sheet 1) I want it to look in sheet 2 for the row which contains what is in A2 ("Bob") and count all instances of cells matching B1 ("Jan"). So the range needs to be the Row in Sheet 2 which starts with "Bob". So it is a variable range for lack of a better word. – bhinojosa – 2019-04-10T18:50:04.643
I realize my original post had some errors. I just fixed those. I hope that helps for anyone trying to assist me with an answer. – bhinojosa – 2019-04-10T20:59:34.750