# Calculate Total Count of hits seen using two references

#### urban_player

##### New Member
Hi Message Board,

I am seeking advice on the following:

I have a column which contains a reference. The reference may be seen multiple times in different rows. In this row, there is another column which contains a number between 1 and 20. I'm trying to calculate the count of how many times it's seen throughout the sheet using another table:

E.g
Data Sheet looks like
Column A: Column C:
SVA-001 1
SVA-001 4
SVA-002 3
SVA-002 3
SVA-002 5
SVA-002 1
SVA-003 4
SVA-004 6

I have another table that has values from 1 to 20. I need to look in Column A for the reference, and then a countif(?) where column C contains the number in the table that has values from 1-20.

What would be the best way, to achieve a lookup using a reference table containing values 1-20.

Reference: Number of times seen
SVA-001 2
SVA-002 3
SVA-003 1
SVA-004 1

I hope this makes sense and any feedback is greatly appreciated. I might be over thinking this or it's friday and my brain has crashed.

Regards,

Urbanuser

### Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).

#### AlanY

##### Well-known Member
try this

Book1
ABCDE
1SVA-0011SVA-0012
2SVA-0014SVA-0024
3SVA-0023SVA-0031
4SVA-0023SVA-0041
5SVA-0025
6SVA-0021
7SVA-0034
8SVA-0046
Sheet2
Cell Formulas
RangeFormula
E1:E4E1=COUNTIF(\$A\$1:\$A\$8,D1)

#### urban_player

##### New Member
Think i might have just sussed it with this ugly looking line
=COUNTIFS('Sheet1'!\$A\$2:\$A\$237,'SheetLookup'!C87:C108,'Sheet1'!\$B\$2:\$B\$237,">=1",'Sheet1'!\$B\$2:\$B\$237,"<=10")

Thanks alot for the quick reply Alan

#### AlanY

##### Well-known Member
Think i might have just sussed it with this ugly looking line
=COUNTIFS('Sheet1'!\$A\$2:\$A\$237,'SheetLookup'!C87:C108,'Sheet1'!\$B\$2:\$B\$237,">=1",'Sheet1'!\$B\$2:\$B\$237,"<=10")

Thanks alot for the quick reply Alan
well, I missed that bit about Col C.
glad that you got t sorted

#### Dossfm0q

##### Banned User
Hi this function good
VBA Code:
``=IF(COUNTIF(A:A,"*SVA-00"&ROWS(\$A\$1:A1)&"*")<>0,"SVA-00"&ROWS(\$A\$1:A1)&" "&COUNTIF(A:A,"*SVA-00"&ROWS(\$A\$1:A1)&"*"),"")``

Replies
6
Views
74
Replies
1
Views
207
Replies
0
Views
35
Replies
0
Views
117
Replies
1
Views
59

Threads
1,127,519
Messages
5,625,278
Members
416,086
Latest member
CaptainGD

### 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

### 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