Morning
Im having trouble counting unique records from my data sheet
on my 'Summary' sheet i have the below.
[TABLE="width: 500"]
<tbody>[TR]
[TD][/TD]
[TD]
[TD]
[TD]
[TD]
[/TR]
[TR]
[TD]
[TD]
[TD]
[TD]
[TD]
[/TR]
[TR]
[TD]
[TD]
[TD]
[TD]
[TD="align: center"]?
[/TD]
[/TR]
[TR]
[TD]
[TD]
[TD]
[TD]
[TD="align: center"]?
[/TD]
[/TR]
</tbody>[/TABLE]
On my 'URData' Sheet i have Columns
[TABLE="width: 500"]
<tbody>[TR]
[TD]
[TD]
[TD]
[/TR]
[TR]
[TD]
[TD]
[TD]
[/TR]
[TR]
[TD]467162761[/TD]
[TD]Oct[/TD]
[TD]15[/TD]
[/TR]
[TR]
[TD]156776464[/TD]
[TD]Oct[/TD]
[TD]15[/TD]
[/TR]
</tbody>[/TABLE]
I have used the below code which works great for Counting Records Uploaded on my 'URData' Sheet which meet the criteria (Q =month & R =Year)
But i need to also count the unique account numbers in column B, with the criteria in Column Q and R
im trying looking all over online but cant seem to be able to find a VBA solution. Any help would be highly appreciated
Thank you
Im having trouble counting unique records from my data sheet
on my 'Summary' sheet i have the below.
[TABLE="width: 500"]
<tbody>[TR]
[TD][/TD]
[TD]
B
[/TD][TD]
C
[/TD][TD]
D
[/TD][TD]
E
[/TD][/TR]
[TR]
[TD]
14
[/TD][TD]
Month
[/TD][TD]
Year
[/TD][TD]
Records Uploaded
[/TD][TD]
Unique Records Uploaded
[/TD][/TR]
[TR]
[TD]
15
[/TD][TD]
Oct
[/TD][TD]
15
[/TD][TD]
500
[/TD][TD="align: center"]?
[/TD]
[/TR]
[TR]
[TD]
16
[/TD][TD]
Nov
[/TD][TD]
15
[/TD][TD]
400
[/TD][TD="align: center"]?
[/TD]
[/TR]
</tbody>[/TABLE]
On my 'URData' Sheet i have Columns
[TABLE="width: 500"]
<tbody>[TR]
[TD]
B
[/TD][TD]
Q
[/TD][TD]
R
[/TD][/TR]
[TR]
[TD]
Account Numbers
[/TD][TD]
Month
[/TD][TD]
Year
[/TD][/TR]
[TR]
[TD]467162761[/TD]
[TD]Oct[/TD]
[TD]15[/TD]
[/TR]
[TR]
[TD]156776464[/TD]
[TD]Oct[/TD]
[TD]15[/TD]
[/TR]
</tbody>[/TABLE]
I have used the below code which works great for Counting Records Uploaded on my 'URData' Sheet which meet the criteria (Q =month & R =Year)
Code:
Sub RecordsUploaded()
Dim Month As String
Dim Year As Integer
Dim Answer As Long
Dim i As Long
Dim EnNum As Long
Dim lastrow As Long
'end range of months
EnNum = (Worksheets("Summary").Cells(Rows.Count, "B").End(xlUp).Row) - 14
'Endrange of data
lastrow = Worksheets("URData").Cells(Rows.Count, "A").End(xlUp).Row
For i = 1 To EnNum
Month = Worksheets("Summary").Cells(14 + i, 2).Value
Year = Worksheets("Summary").Cells(14 + i, 3).Value
Answer = WorksheetFunction.CountIfs(Worksheets("URData").Range("Q2: Q" & lastrow), Month, Worksheets("URData").Range("R2: R" & lastrow), Year)
Worksheets("summary").Cells(14 + i, 4).Value = Answer
Next
End Sub
But i need to also count the unique account numbers in column B, with the criteria in Column Q and R
im trying looking all over online but cant seem to be able to find a VBA solution. Any help would be highly appreciated
Thank you
Last edited: