Simple search in existing excel file
I ha开发者_如何学Pythonve an excel file in which in A column i have the name of the stock, and in E and F column i have the stock rate and daily change.
I need a function which receives a string (stock name), and and for that string finds the suitable rate and daily change(the values in columns E and F).
Any ideas on how to implement? I am not familiar with excel in c# and looking at tutorials i am still in the blank.
Thanks.
Long long time ago but anyway. I'm trying to do something similar and came across this recently:
http://msdn.microsoft.com/en-us/library/e4x1k99a(v=vs.80).aspx
Hope that helps.
Let's assume you have the following data in Excel:
A B C D E F
1 Stock Price Change
2 MSFT $123.45 +0.67
3 ATT $456.00 -1.23
4 IBM $789.00 +9.87
5 GOOG $543.00 -6.54
6
7
8 Stock: IBM
9 Price: {F1}
10 Change: {F2}
Use the following formula in place of {F1}: =VLOOKUP(B8, $A$2:$F$5, 5)
.
Use the following formula in place of {F2}: =VLOOKUP(B8, $A$2:$F$5, 6)
.
(Do not type {F1} and {F2} in Excel - type in the formulae above.)
Take a look at documentation for VLOOKUP function.
精彩评论