I'm trying to create VBA code (or functions if possible) that will identify all matching entries in column A and then total the values in a range from columns B through E from the rows with the matching entries, and then continue on to the next set of matching entries in column A.
For example, the code would identify that the column A cells values A2, A3, and A4 match, total the values in range B2:E4, and enter the total in cell F2 (or F4). The code then would continue down column A identifying that cells A5 and A6 match, total the values in range B5:E6, and enter the total in cell F5 (or F6). And so on... The entries in column A will be sorted so like entries are always in order. See example below (the different colors are just for emphasis).
<style type="text/css"><!--td {border: 1px solid #ccc;}br {mso-data-placement:same-cell;}--></style>
<colgroup><col style="width: 123px"><col width="123"><col width="100"><col width="100"><col width="100"><col width="100"><col width="100"></colgroup><tbody>
</tbody>
For example, the code would identify that the column A cells values A2, A3, and A4 match, total the values in range B2:E4, and enter the total in cell F2 (or F4). The code then would continue down column A identifying that cells A5 and A6 match, total the values in range B5:E6, and enter the total in cell F5 (or F6). And so on... The entries in column A will be sorted so like entries are always in order. See example below (the different colors are just for emphasis).
<style type="text/css"><!--td {border: 1px solid #ccc;}br {mso-data-placement:same-cell;}--></style>
A | B | C | D | E | F | ||||||
1 | Company Name | Quantity 1 | Quantity 2 | Quantity 3 | Quantity 4 | Total | |||||
2 | ABC |
<tbody> </tbody> | 1 | 10 | |||||||
3 | ABC | 3 | |||||||||
4 | ABC | 6 | |||||||||
5 | EFG | 4 | 11 | ||||||||
6 | EFG | 7 | |||||||||
7 | RST | 3 | 19 | ||||||||
8 | RST | 9 | |||||||||
9 | RST | 5 | |||||||||
10 | RST | 2 | |||||||||
11 | UVW | 4 | 4 | ||||||||
12 | XYZ | 5 | 5 |
<colgroup><col style="width: 123px"><col width="123"><col width="100"><col width="100"><col width="100"><col width="100"><col width="100"></colgroup><tbody>
</tbody>