ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Merging to data sets (https://www.excelbanter.com/excel-worksheet-functions/158866-merging-data-sets.html)

Arun Kumar Saha

Merging to data sets
 
Hi all, hope all r doing well. Here i am struggling to write a VBA code which correspond to following:

Suppose I have four columns :

Date Price1 Date Price2
1/1/04 12 1/1/04 13
1/2/04 14 1/3/04 23
1/5/04 11 1/5/04 15
1/7/04 14 1/7/04 19
1/8/04 16 1/9/04 20

Where Price1 is prices for some stock1 and price2 is for stock2.

Now I want to merge these two price series according to common dates. That is I want to get following:

Date Price1 Price2
1/1/04 12 13
1/5/04 11 15
1/7/04 14 19


And separately,

Date Price1 Price2
1/1/04 12 13
1/2/04 14 NA
1/3/04 NA 23
1/5/04 11 15
1/7/04 14 19
1/8/04 16 NA
1/9/04 NA 20

Is there any Excel in-build function to do this type of calculation? Otherwise can anyone help me to write a VBA code for that?

Regards,


All times are GMT +1. The time now is 01:22 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com