简体   繁体   中英

How to align two data sets by date in excel

Given two time series with date and price (but dates don't align, ie holidays etc) how can i align the two price series against one set of dates (using vlookup?)?

Example:
Mar 1, 2016 | 101.52 | Mar 1, 2016 | 204.57
Mar 2, 2016 | 103.17 | Mar 3, 2016 | 207.13
Mar 3, 2016 | 102.10 | Mar 4, 2016 | 224.03
Mar 6, 2016 | 101.87 | Mar 5, 2016 | 217.15

should result in:
Mar 1, 2016 | 101.52 | Mar 1, 2016 | 204.57
Mar 2, 2016 | 103.17 | Mar 2, 2016 | 204.57
Mar 3, 2016 | 102.10 | Mar 3, 2016 | 207.13
Mar 5, 2016 | 102.10 | Mar 5, 2016 | 217.15
Mar 6, 2016 | 101.87 | Mar 6, 2016 | 217.15

Thank you.

OK, take a deep breath and follow along...

Suppose data is in A2:D100...

  • Formula for Column E: =MATCH(C2,$A$2:$A$100,0)
  • Formula for Column F: =MATCH(A2,$C$2:$C$100,0)
  • Filter col E for #N/A
  • Copy dates from col C to first empty row of A
  • Unfilter col E, Filter col F on #N/A
  • Copy dates from col A to C
  • Remove filter from sheet (no filter dropdowns)
  • Sort JUST Col A+B on A
  • Sort JUST Col C+D on C
  • Select col B
  • F5, Special, Empty cells
  • OK
  • type = sign, arrow up, control+enter
  • Select B again
  • Control+C
  • Control+alt+V, choose Values.
  • Repeat the part starting from "Select col B" for col D.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM