Need VBA Macro to create new sheet2 with the output of Sheeet1

gollangi

New Member
Joined
Sep 1, 2017
Messages
1
Hi,

I want to convert the below Sheet 1 excel data to to Sheet 2 Excel Data. Could you please help. Whether in simple code or any macros.


In Sheet 2 Year(Dropdown values(2014,2015,2016), if user selects 2014, then 2014 data only should display. So based on the year the records should display.

And in last row need to get the sum of Units and Values.

Can anyone help to figure out how to implement.

This is Sheet 1.


North America
Product
Product Code
Reporting Countries
Trade Flow
Import
2014
2015
2016
Unit (T) Value ($) Unit (T) Value ($) Unit (T) Value ($)
Canada Test Product 1 391110 Australia 1 44299
Canada Test Product 2 391110 Bolivia 294
Canada Test Product 3 391110 Canada 34 51302 14 47779 6 19749
Canada Test Product 4 391110 Chile 271 682
Canada Test Product 5 391110 China 7786
Canada Test Product 6 391110 Colombia 1 1504
Canada Test Product 7 391110 Guatemala 339
Canada Test Product 8 391110 India 1390 40977
Canada Test Product 9 391110 Indonesia 1504 2957
Canada Test Product 10 391110 Japan 2572
Canada Test Product 11 391110 Malaysia 4452 4 17660
Canada Test Product 12 391110 Mexico 330
Canada Test Product 13 391110 Netherlands 1 1071 462
Canada Test Product 14 391110 Norway 389
Canada Test Product 15 391110 Portugal 555
Canada Test Product 16 391110 Russia 467
Canada Test Product 17 391110 South Africa 971
Canada Test Product 18 391110 South Korea 12952 8056 3550
Canada Test Product 19 391110 Sweden 1366
Canada Test Product 20 391110 Switzerland 385
Canada Test Product 21 391110 Taiwan 3 14365
Canada Test Product 22 391110 Thailand 1838
Canada Test Product 23 391110 United Kingdom HMRC 2322
Canada Test Product 24 391110 United States 147 362560 120 313121 85 294933

<tbody>
</tbody>



This is Sheet 2.

North America
Product
HS Code
Reporting Countries
Trade Flow
Year
Unit (T) Value ($)
Canada Trade Product 1 468923 Australia 1 44299
Canada Trade Product 2 468924 Bolivia
Canada Trade Product 3 468925 Canada 34 51302
Canada Trade Product 4 468926 Chile 271
Canada Trade Product 5 468927 China
Canada Trade Product 6 468928 Colombia 1 1504
Canada Trade Product 7 468929 Guatemala0 339
Canada Trade Product 8 468930 India0 1390
Canada Trade Product 9 468931 Indonesia
Canada Trade Product 10 468932 Japan
Canada Trade Product 11 468933 Malaysia
Canada Trade Product 12 468934 Mexico
Canada Trade Product 13 468935 Netherlands 1 1071
Canada Trade Product 14 468936 Norway 389
Canada Trade Product 15 468937 Portugal
Canada Trade Product 16 468938 Russia 467
Canada Trade Product 17 468939 South Africa
Canada Trade Product 18 468940 South Korea 12952
Canada Trade Product 19 468941 Sweden
Canada Trade Product 20 468942 Switzerland
Canada Trade Product 21 468943 Taiwan
Canada Trade Product 22 468944 Thailand
Canada Trade Product 23 468945 United Kingdom HMRC
Canada Trade Product 24 468946 United States 147 362560

<tbody>
</tbody>
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.

Forum statistics

Threads
1,215,577
Messages
6,125,640
Members
449,242
Latest member
Mari_mariou

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top