I have the following problem with VBA:
I have a list of names of persons with a rank (either "1" or "2", see below) and I want to search their number of occurrences in another table and add up the ranks.
Person Data:
[TABLE="width: 200"]
<tbody>[TR]
[TD]Person[/TD]
[TD]Rank[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]B[/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD]K[/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD]P[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]U[/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD]T[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]...[/TD]
[TD]...[/TD]
[/TR]
</tbody>[/TABLE]
Company Data:
[TABLE="width: 400"]
<tbody>[TR]
[TD]Company[/TD]
[TD]Persons[/TD]
[TD]Combined Rank[/TD]
[/TR]
[TR]
[TD]C1[/TD]
[TD]A(), B (..)[/TD]
[TD]3 [= Rank(A)+Rank(B)=1 + 2][/TD]
[/TR]
[TR]
[TD]C2[/TD]
[TD]K[/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD]C3[/TD]
[TD]K [--], P, A, T[/TD]
[TD]5 [=2 + 1 + 1 + 1] [/TD]
[/TR]
[TR]
[TD]C4[/TD]
[TD]Q[/TD]
[TD]0[/TD]
[/TR]
[TR]
[TD]C5[/TD]
[TD]-[/TD]
[TD]0[/TD]
[/TR]
[TR]
[TD]C6[/TD]
[TD]A, U{ff}[/TD]
[TD]3 [=1 + 2][/TD]
[/TR]
[TR]
[TD]...[/TD]
[TD]...[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
Thanks a lot for your help.
I have a list of names of persons with a rank (either "1" or "2", see below) and I want to search their number of occurrences in another table and add up the ranks.
Person Data:
[TABLE="width: 200"]
<tbody>[TR]
[TD]Person[/TD]
[TD]Rank[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]B[/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD]K[/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD]P[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]U[/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD]T[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]...[/TD]
[TD]...[/TD]
[/TR]
</tbody>[/TABLE]
Company Data:
- red is what needs to be written in Col "Combined Rank")
- In my Company Data, the names of the persons data are sometimes followed by random brackets and/or spaces and then brackets
[TABLE="width: 400"]
<tbody>[TR]
[TD]Company[/TD]
[TD]Persons[/TD]
[TD]Combined Rank[/TD]
[/TR]
[TR]
[TD]C1[/TD]
[TD]A(), B (..)[/TD]
[TD]3 [= Rank(A)+Rank(B)=1 + 2][/TD]
[/TR]
[TR]
[TD]C2[/TD]
[TD]K[/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD]C3[/TD]
[TD]K [--], P, A, T[/TD]
[TD]5 [=2 + 1 + 1 + 1] [/TD]
[/TR]
[TR]
[TD]C4[/TD]
[TD]Q[/TD]
[TD]0[/TD]
[/TR]
[TR]
[TD]C5[/TD]
[TD]-[/TD]
[TD]0[/TD]
[/TR]
[TR]
[TD]C6[/TD]
[TD]A, U{ff}[/TD]
[TD]3 [=1 + 2][/TD]
[/TR]
[TR]
[TD]...[/TD]
[TD]...[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
Thanks a lot for your help.