HI VenKat - can you also try and help me some VBA code: I have three columns. Column A has the name of the fruit juice, Column B the size of the bottle and Column C the value. I need to match the product with size and add values to a single cell. In the example: = Mango 350ml 7000.000 or Apple 500ml 21620.00
[TABLE="width: 413"]
<tbody>[TR]
[TD]Mango[/TD]
[TD="align: right"]350ML[/TD]
[TD] R 5,000.00[/TD]
[/TR]
[TR]
[TD]Mango[/TD]
[TD="align: right"]350[/TD]
[TD] R 2,000.00[/TD]
[/TR]
[TR]
[TD]Mango[/TD]
[TD="align: right"]250[/TD]
[TD] R 3,000.00[/TD]
[/TR]
[TR]
[TD]Mango[/TD]
[TD="align: right"]250[/TD]
[TD] R 6,000.00[/TD]
[/TR]
[TR]
[TD]Mango[/TD]
[TD="align: right"]125[/TD]
[TD] R 1,200.00[/TD]
[/TR]
[TR]
[TD]Tropical[/TD]
[TD="align: right"]125[/TD]
[TD] R 4,000.00[/TD]
[/TR]
[TR]
[TD]Apple[/TD]
[TD="align: right"]125[/TD]
[TD] R 8,000.00[/TD]
[/TR]
[TR]
[TD]Apple[/TD]
[TD="align: right"]500[/TD]
[TD] R 9,000.00[/TD]
[/TR]
[TR]
[TD]Apple[/TD]
[TD="align: right"]500[/TD]
[TD] R 7,000.00[/TD]
[/TR]
[TR]
[TD]Apple[/TD]
[TD="align: right"]500[/TD]
[TD] R 5,620.00[/TD]
[/TR]
[TR]
[TD]Tropical[/TD]
[TD="align: right"]350[/TD]
[TD] R 3,526.00[/TD]
[/TR]
[TR]
[TD]Tropical[/TD]
[TD="align: right"]350[/TD]
[TD] R 2,545.00[/TD]
[/TR]
[TR]
[TD]Tropical[/TD]
[TD="align: right"]350[/TD]
[TD] R 5,895.00[/TD]
[/TR]
</tbody>[/TABLE]
This is a different situation -related, but, is not the same-
For this, you have a native solution, "sum if"
Just try to organize your data prior.
Example:
(as you may notice, STD the 350ML for 350 instead and the real Qty for the number
[TABLE="width: 500"]
<colgroup><col><col span="3"><col><col></colgroup><tbody>[TR]
[TD]A[/TD]
[TD]B[/TD]
[TD]C[/TD]
[TD]D[/TD]
[TD]Formula[/TD]
[TD]Result[/TD]
[/TR]
[TR]
[TD]Mango[/TD]
[TD]350[/TD]
[TD]R 5,000.00[/TD]
[TD="align: right"]5000[/TD]
[TD]=SUMIFS(D:D;A:A;A1;B:B;B1)[/TD]
[TD="align: right"]7000[/TD]
[/TR]
[TR]
[TD]Mango[/TD]
[TD]350[/TD]
[TD]R 2,000.00[/TD]
[TD="align: right"]2000[/TD]
[TD]=SUMIFS(D:D;A:A;A2;B:B;B2)[/TD]
[TD="align: right"]7000[/TD]
[/TR]
[TR]
[TD]Mango[/TD]
[TD]250[/TD]
[TD]R 3,000.00[/TD]
[TD="align: right"]3000[/TD]
[TD]=SUMIFS(D:D;A:A;A3;B:B;B3)[/TD]
[TD="align: right"]9000[/TD]
[/TR]
[TR]
[TD]Mango[/TD]
[TD]250[/TD]
[TD]R 6,000.00[/TD]
[TD="align: right"]6000[/TD]
[TD]=SUMIFS(D:D;A:A;A4;B:B;B4)[/TD]
[TD="align: right"]9000[/TD]
[/TR]
[TR]
[TD]Mango[/TD]
[TD]125[/TD]
[TD]R 1,200.00[/TD]
[TD="align: right"]1200[/TD]
[TD]=SUMIFS(D:D;A:A;A5;B:B;B5)[/TD]
[TD="align: right"]1200[/TD]
[/TR]
[TR]
[TD]Tropical[/TD]
[TD]125[/TD]
[TD]R 4,000.00[/TD]
[TD="align: right"]4000[/TD]
[TD]=SUMIFS(D:D;A:A;A6;B:B;B6)[/TD]
[TD="align: right"]4000[/TD]
[/TR]
[TR]
[TD]Apple[/TD]
[TD]125[/TD]
[TD]R 8,000.00[/TD]
[TD="align: right"]8000[/TD]
[TD]=SUMIFS(D:D;A:A;A7;B:B;B7)[/TD]
[TD="align: right"]8000[/TD]
[/TR]
[TR]
[TD]Apple[/TD]
[TD]500[/TD]
[TD]R 9,000.00[/TD]
[TD="align: right"]9000[/TD]
[TD]=SUMIFS(D:D;A:A;A8;B:B;B8)[/TD]
[TD="align: right"]21620[/TD]
[/TR]
[TR]
[TD]Apple[/TD]
[TD]500[/TD]
[TD]R 7,000.00[/TD]
[TD="align: right"]7000[/TD]
[TD]=SUMIFS(D:D;A:A;A9;B:B;B9)[/TD]
[TD="align: right"]21620[/TD]
[/TR]
[TR]
[TD]Apple[/TD]
[TD]500[/TD]
[TD]R 5,620.00[/TD]
[TD="align: right"]5620[/TD]
[TD]=SUMIFS(D:D;A:A;A10;B:B;B10)[/TD]
[TD="align: right"]21620[/TD]
[/TR]
[TR]
[TD]Tropical[/TD]
[TD]350[/TD]
[TD]R 3,526.00[/TD]
[TD="align: right"]3526[/TD]
[TD]=SUMIFS(D:D;A:A;A11;B:B;B11)[/TD]
[TD="align: right"]11966[/TD]
[/TR]
[TR]
[TD]Tropical[/TD]
[TD]350[/TD]
[TD]R 2,545.00[/TD]
[TD="align: right"]2545[/TD]
[TD]=SUMIFS(D:D;A:A;A12;B:B;B12)[/TD]
[TD="align: right"]11966[/TD]
[/TR]
[TR]
[TD]Tropical[/TD]
[TD]350[/TD]
[TD]R 5,895.00[/TD]
[TD="align: right"]5895[/TD]
[TD]=SUMIFS(D:D;A:A;A13;B:B;B13)[/TD]
[TD="align: right"]11966[/TD]
[/TR]
</tbody>[/TABLE]