jamesmoonusa / VBA_Stock_Analysis

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Overview of Project

Creating VBA Macro for a client who wants to analyzing 2017 and 2018 Stock datasheet to see volume and return rate. Additionaly refactoring the code for improvement.

Result

  1. On 2018 only ENPH and RUN stocks has positive return. 2018 Result
  2. On 2017 All Stocks has positive return except TERP. 2017 Ressult
  3. Original VBA run time has significally reduced. 2017 Origianl VBA VS 2017 Refactored VBA, 2018 Original VBA VS 2018 Refactored VBA

Summary for Refactoring

  • Refactoring code would be improve the code in many ways such as efficiency, clarity, readability and so on.
  • BUT refactoring code can consmue lots of time and effort to improve, and the improvement might not effective as much as expected. For example a Macro runs 1 sec, and after spending days on the code Macro runds now 0.5 sec. Saving 0.5 Sec was worth to do as spending DAYS? The answer could be depends on cases, but definielty this should be one of factor that need to be consider when we do Refactoring

Summary for our VBA

  • There was a signficant reduce on Original VBA run time and readability as refactoring the code
  • Normally it should be good to have a nice, neat and clean code for running and reading but if the code that will be used once a year, then I do not think we need to spend time to make improvement on the code.