Countif(s) or similar using data from different tables

hphillips

New Member
Joined
Nov 1, 2017
Messages
3
Hi all,

Hopefully someone can help me with this because it's driving me mad.

I have two tables on separate sheets. The first holds a list of cases and who managed the case (and how long it was open, but that one is less relevant for now). The second has a list of staff that appear in the first table and their location (UK/US).

e.g. Table 1
Case NumberOwner
1Jane
2Joe
3Sarah
4Sarah
5Harry

<tbody>
</tbody>

Table 2
NameLocation
HarryUK
JaneUK
JoeUS
SarahUS

<tbody>
</tbody>


What I want to be able to get is the number of cases in each location - and ideally I'd just be able to drop fresh data in my table of cases and have the totals 'magically' recalculate.

Obviously I can do it quite simply if I add a VLookup to the location on the first table and then just use CountIf, but I'd like to avoid this step if possible as once I've set it up this will be handed over to other people to manage.

Are there any solutions out there?

Thanks.
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
Hi, welcome to the board!

Here is one option you could try:


Excel 2013/2016
ABCDEFGH
1CaseOwnerNameLocationLocCount
21JaneHarryUKUK2
32JoeJaneUKUS3
43SarahJoeUS
54SarahSarahUS
65Harry
Sheet2
Cell Formulas
RangeFormula
H2=SUMPRODUCT(--ISNUMBER(MATCH($B$2:$B$6&"|"&G2,$D$2:$D$5&"|"&$E$2:$E$5,0)))
 
Last edited:
Upvote 0
You should be able to work this backwards from the Name/Location table:


Book1
AB
1Case NumberOwner
21Jane
32Joe
43Sarah
54Sarah
65Harry
7
8NameLocation
9HarryUK
10JaneUK
11JoeUS
12SarahUS
13
14UK2
15US3
Sheet4
Cell Formulas
RangeFormula
B14{=SUM(IF($B$9:$B$12=$A14,COUNTIF($B$2:$B$6,$A$9:$A$12)))}
Press CTRL+SHIFT+ENTER to enter array formulas.


WBD
 
Upvote 0
Thanks both of you.

Unfortunately both of these solutions only work if I put in exact cell references which would mean updating the formulas each time as we won't have the same amount of data in each report.
 
Upvote 0
Unfortunately both of these solutions only work if I put in exact cell references which would mean updating the formulas each time as we won't have the same amount of data in each report.

Hi, you have several options.

1. Use tables and structured references (my preference)
2. Simply extend the ranges used by the formula's to sensible maximums
3. Use dynamic named ranges
 
Upvote 0
And not forgetting this option:

4. Give a clear and accurate description of your problem in your original post.

:D

WBD
 
Upvote 0
Hi, you have several options.

1. Use tables and structured references (my preference)
2. Simply extend the ranges used by the formula's to sensible maximums
3. Use dynamic named ranges

Thanks!

I've got it working with dynamic named ranges so that's something.

I'll have a play with structured references and see if I can get that working too.
 
Upvote 0
Make sure both tables are formatted as table. Then create a pivot table in which you point to both tables. Excel will ask you to define a relationship between both tables.
 
Upvote 0

Forum statistics

Threads
1,215,339
Messages
6,124,370
Members
449,155
Latest member
ravioli44

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top