This reply has been accepted as the best answer.
step 1 :- first choose which programming language you want to use..all popular programming language is absolutely free..only things is you must learn/know it.
Nitin Sir use Visual Basic
I am using python for automation so i can explain you
step 2:-Study what is Xpath (to identify and navigate nodes/data in an XML/html page )
step 3:-Store the data to excel/server.I use Pythons Pandas library to store the data to excel..You need deep knowledge of mysql data base for storing data in web Server
step 4:calculating data is easy if u done all the above steps..just google every query you will get your solution