# 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

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use \$ signs: \$V\$2:\$Z\$99 will always point to V2:Z99, even after copying

#### 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
81
Replies
1
Views
275
Replies
0
Views
45
Replies
0
Views
128
Replies
1
Views
63

1,130,217
Messages
5,640,945
Members
417,181
Latest member
mgcorreia

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

### Which adblocker are you using?

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

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