So I don't know if I'm framing this correctly. I have a database with thousands of rows. Column A is a code that identifies a specific product, and Column B has a (0-no;1-yes) value. I need each row in Column C to have the sum of all values in Column B, for each specific product in Column A.
In the example below, there are three products, and Column C is how the output should look like. All rows with X in Column A sum the values Column B (only from said rows) and the result printed on all of the same rows in Column C. Every row with X (Column A) should have a 5 (Column C), which is the sum of all 1s in Column B (only on rows with an X).
| Column A | Column B | Column C |
|---|---|---|
| X | 1 | 5 |
| Y | 0 | 2 |
| Y | 1 | 2 |
| Z | 0 | 1 |
| X | 1 | 5 |
| X | 1 | 5 |
| Z | 1 | 1 |
| X | 1 | 5 |
| Z | 0 | 1 |
| X | 1 | 5 |
| X | 0 | 5 |
| Z | 0 | 1 |
| Y | 1 | 2 |
Keep in mind that there are thousands of products with different and complex IDs (Column A). I thought of creating a Dynamic Table that gives me the result (sum of B for said values) in a different sheet and then merging both based on Column A values, but I'm trying to do this in one single step with a code in Column C.

There are few ways of doing this, perhaps for readability one can use the following formulas:
Or Using
SUMIF()may be:With out returning the whole array and only for column
CAnother alternative is to use
MMULT()