Combine non-empty data ranges & then sort

dmccubbi

New Member
Joined
May 28, 2009
Messages
10
Hi All,

In Excel, I named three empty data ranges, with the following number of columns and rows:

Temp_One : 20 rows, 15 columns
Temp_Two : 30 rows, 15 columns
Temp_Three : 50 rows, 15 columns

I then loaded these named ranges into a VBA macro:

Temp1 = Range("Temp_One").Value
Temp2 = Range("Temp_Two").Value
Temp3 = Range("Temp_Three").Value

In the macro, I did some calculations to add 15 rows of data to Temp1 and 25 rows of data to Temp2. (In the future, the number of non-empty rows will vary.)

Now, I want to stack Temp1 and Temp2, assign this to Temp3 (which would then have 40 non-empty values), and then sort Temp3 by the first column (a year variable).

I am not sure, however, how to stack and then sort the data. In something like SAS I could do the following:

data temp3;
set temp1 temp2;
run;
proc sort data=temp3;
by year;
run;

Thanks in advance for any advice.

Best regards,
Don
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
Hi,

In case you are curious, I should have added some context. I am working with global greenhouse gas (GHG) emissions data and building a reduced form model of climate forcing in Excel. Ultimately, this will part of a model examining lifecycle GHG emissions of alternative transportation fuels.

Best,
Don
 
Upvote 0

Forum statistics

Threads
1,224,518
Messages
6,179,253
Members
452,900
Latest member
LisaGo

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