View Single Post
  #1   Report Post  
Arun Kumar Saha Arun Kumar Saha is offline
Junior Member
 
Posts: 10
Default 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,