I need a VBA code to create table that sums total sale and quantity by department getting information from 2 worksheets:
Worksheet "Data": Lists the "Employee", "quantity", and "cost"
Worksheet "Department": Lists/ defines "Employee" & "Department"
I need to fill a table in a third worksheet "Report", summing the "Total quantity", and the "Total Cost" by "Department" using the data in the above worksheets. I am attaching example file. Thanks.
Need VBA code to sum data from 2 tables by matching a field
-
-
-
Re: Need VBA code to sum data from 2 tables by matching a field
Why use two tables? Add columns to the Data Table then use a PivotTable
-
Re: Need VBA code to sum data from 2 tables by matching a field
Here's an example using the data formatted as actual Excel Table with an added column to add the department using VLOOKUP. The data report is then easily created using a PivotTable. No VBA is needed at all.
-
Re: Need VBA code to sum data from 2 tables by matching a field
Quote from royUK;724127Here's an example using the data formatted as actual Excel Table with an added column to add the department using VLOOKUP. The data report is then easily created using a PivotTable. No VBA is needed at all.
Thanks royUK! seems the pivot table is a good idea. I wish if I can learn more about it. Thanks a lot!
-
Re: Need VBA code to sum data from 2 tables by matching a field
You should learn basic Excel such as PivotTables before considering VBA.
-
Participate now!
Don’t have an account yet? Register yourself now and be a part of our community!