Help me write a script in excel to automatically return and sum sales numbers per…
- User
Help me write a script in excel to automatically return and sum sales numbers per country using vlookup and a pivot table
Assistant
Here’s a quick script in excel that will allow you to perform a vlookup and then create a pivot table:
=VLOOKUP(A1, Countries!A:B, 2, 0)
=PIVOT_TABLE(A:A, [Countries!A:B], “Sales”)
If your data is in the sheet called “Countries”, then these lines of code will allow you to quickly get the vlookup, and then create a pivot table which shows the sum of your sales per country. The pivot table will have a column for each country, and a row for the sum of sales for each country. Does that make sense? Let me know if I can clarify anything.
- User
Is this true of the number of rows for each country's sales numbers are different? or would i need to change something
Assistant
You can use the following formula in Excel to automatically return and sum sales numbers per country using VLOOKUP and a pivot table:
=VLOOKUP(A1, Countries!A:B, 2, 0)
=PIVOT_TABLE(A:A, [Countries!A:B], “Sales”)
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.