Giter VIP home page Giter VIP logo

vba-challenge's Introduction

VBA-challenge

Aim of this challenge was to put forth our VBA scripting skills to the test by analyzing annual stock market data of three years. Data was acquired for the years, 2018 to 2020 spread across three different sheets in the workbook. The challenge was to traverse through multiple columns of each sheet, fetch differing values for Ticker symbol, calculate the yearly change of stock price, calculate percentage change and the total stock volume for each stock. Additionally, we had to create a summary table providing data on the greatest percentage increase and decrease in the stock and the greatest total stock volume for each year.

How to Install and Run the script

  1. Ensure folders Images, Resources, excel file Multiple_year_stock_data.xlsm and the Multiple_year_stock_data_sol.vbs files are present
  2. Clone the Git repo into your local machine
  3. Ensure you have Excel with VBA scripting enabled
  4. Open Multiple_year_stock_data.xlsm with Excel, select Developer and Visual Basic
  5. Ensure the output is not present in the excel workbook
  6. Open the module, check the script, run the macro named stock_analysis and verify the results
  7. Additionally, there is a sample data file alphabetical_testing.xlsx in the Resources folder to experiment with and get your desired results
  8. Please re-save the alphabetical_testing.xlsx file as a Macro Enabled Workbook to ensure VBA script works

VBA_Stock_analysis_2018

VBA_Stock_analysis_2019

VBA_Stock_analysis_2020

Credits

In order to solve this challenge, I went over all the class videos and re-did the class activities. Class 3 activities helped me understand how to loop through all the sheets in a workbook. Activity, credit card checker gave me an idea on traversing through a column and finding the different values in it. This helped me understand how to get the ticker symbol and the total stock volume. Additionally, through the youtube link, I could discover new methods such as Select Case for conditional formatting and WorkSheetFunctions such as max, min and match to get the summary table values and the respective rows. I also worked with my TA is ensure the code was right and all the values printed were correct. I did get a glance as the solution only to format my yearly change column to "0.00" format, which I learnt could be done using NumberFormat method in VBA (I used Round function in VBA, but it didn't work as expected)

References

https://learn.microsoft.com/en-us/dotnet/visual-basic/language-reference/data-types/single-data-type

https://learn.microsoft.com/en-us/office/vba/api/excel.range.autofit#syntax

http://dmcritchie.mvps.org/excel/colors.htm

https://support.microsoft.com/en-us/topic/macro-to-loop-through-all-worksheets-in-a-workbook-feef14e3-97cf-00e2-538b-5da40186e2b0

https://learn.microsoft.com/en-us/office/vba/language/reference/user-interface-help/select-case-statement

https://learn.microsoft.com/en-us/office/vba/api/excel.worksheetfunction.match

https://www.youtube.com/watch?v=ZInAsziSb8o&ab_channel=TheBootCamp

https://www.homeandlearn.org/excel_vba_practice1.html

https://learn.microsoft.com/en-us/office/vba/library-reference/concepts/getting-started-with-vba-in-office

vba-challenge's People

Contributors

jayashreekotte avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.