I have a summary sheet (sheet 2, called January_SUM") for each month (Obviously renaming each month). I need to count the number of times an employee went to a certain location (only tracking how many times they went to Chicago, Boston, or Raleigh).
In sheet one ("January_Data"), the data to answer that question is provided. The unique identifier in both sheets is their employee number.
How it will work is that the WB will be set up with a January_Data sheet that will be empty until I paste the data in from another location. As you can see, it will provide the employee number in col-A and locations in B-E.
Sheet 1 "January_Data" below:
col-A Col-B Col-C Col-D Col-E
Row-1 4467 Chicago Boston Raleigh Raleigh
Row-2 7230 Boston Raleigh Boston
Row-3 213 Boston Chicago Raleigh Chicago
Row-4 99321 Raleigh Raleigh Boston Raleigh
Row-5 23187 Boston Boston Chicago Boston
Sheet 2 "January_SUM" below:
Col-A Col-B Col-C Col-D Col-E
1: Name Emp. # Chicago Boston Raleigh
2: Smith 23187
3: Jones 49983
4: Doe 213
5: Clemens 4467
6: Reid 7230
7: Kelly 1092
8: Pappack 99321
So I need a formula to put in Col-C that will look on the January_Data sheet and find the employee number that matches the January_Sum sheet and counts the number of times Chicago appears in that employees row (on the January_Data sheet). I can then copy-fill down and use the formula on the next two columns by just changing the location in the formula I assume.
I was trying to put together an Index-Match-Countif formula thinking that was the way to go but got nowhere, (likely because I just don't have enough experience yet).
Thank you for taking the time to assist me (and thereby help teach me).
If you are using Excel 2007 or later, in C2 of January_Sum you can put in the formula
Note that the function is COUNTIFS with an "S" on the end. This was added to excel in Excel 2007 and allows you to specify multiple criteria.
You can then copy this to the right, then select the cells with the formula (C2:E2 and fill down the columns
The C$1 picks up the city name from the top row (the $ fixes the row reference) for the same column so you don't have to edit the formula. The $B2 fixes the column reference to column B and gets the employee number for that row.
That should do what you want.
---------- FOLLOW-UP ----------
QUESTION: I am getting a "value" error. From what I can gather by reading online, the error appears to be a result of the two ranges not having the same number of columns.
This statement caught my attention when looking for a resolution in an online excel forum:"Each additional range must have the same number of rows and columns as the first range (criteria_range1 argument)."
When I separate the criteria 1 range, criteria and the criteria 2 range, criteria as stand alone formulas, they work. However, I need them to work together since knowing how many times all the employee went to Chicago isn't what I need. I need to know how many times each employee went to each location.
Thank you for any clarification you might be able to provide.
Your correct. I wasn't thinking that through. I was thinking of a different approach using array formula. This is tested on your data and worked for me:
drag across and then fill down.
Name Emp No. Chicago Boston Raleigh
Smith 23187 1 3 0
Jones 49983 0 0 0
Doe 213 2 1 1
Clemens 4467 1 1 2
Reid 7230 0 2 1
Kelly 1092 0 0 0
Pappack 99321 0 1 3