Hi Team,
I want to sum scores of few playear as per Criteria List.
Column A and B are my Data.Criteria list is in Column E. List may Increase.
Is there any direct excel formula? to get the same
looking in excel formula /Dictionary/loop
My attempted code which is not working. getting stuck second loop.
Thanks
mg
I want to sum scores of few playear as per Criteria List.
Column A and B are my Data.Criteria list is in Column E. List may Increase.
Is there any direct excel formula? to get the same
looking in excel formula /Dictionary/loop
Name | Score | Criteria List | Expected sum | |||
Dhoni | 10642 | Sehwag | ||||
Virat | 11498 | Dhoni | ||||
Rohit | 10857 | Total Scores Made by Sachin and Sehwag | 22424 | |||
Sachin | 12657 | |||||
Sehwag | 11782 |
My attempted code which is not working. getting stuck second loop.
VBA Code:
Option Explicit
Sub Sum_Range_as_per_Criteria()
Dim i As Long, Arr_Cr As Variant
Dim int_total As Long
'Criteria Value
Arr_Cr = WorksheetFunction.Transpose(Range("E2:E3").Value)
For i = 2 To Range("A1000").End(xlUp).Row
If IsNumeric(WorksheetFunction.Match(Cells(i, 1).Value, Arr_Cr, 0)) Then
int_total = int_total + Cells(i, 2).Value
End If
Next i
End Sub
Thanks
mg