Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
I need help with the finer points of retaining closing prices for a group of
mutual funds on a weekly and monthly basis. I have a large Excel 2007 file containing 70 worksheets and the solution has to work well within this file. Using data/get external data/from web, I have been able to download closing prices to a new worksheet in the file. For this discussion, suppose A1 is Fund X and A2 is 40.00, the closing price. I then need to populate the 40.00 price to various other worksheets in the file, at the end of every week and month. I know how to do that with a formula directly referencing the worksheet and A2, and I have figured out how to use VLOOKUP to do much the same thing. So far, so good. But I can foresee problems when the day comes that row A in the download worksheet no longer refers to Fund X. Perhaps it has been sold and I am no longer tracking it. In that case, any previously entered formula referring to cell A2 is going to give another value or generate an error. That's not good because all my historical data will show errors or erroneous values as well. Unfortunately, when the formula does its thing, the cell contains a reference back to A2, rather than the 40.00 value per se. If A2 changes, the displayed value in any cell containing a formula referencing A2 changes as well. I want to be able to retain my historical weekly and monthly prices, even though the download worksheet may have been significantly altered or even deleted, for that matter. My Excel skills are modest. Not a novice, but hardly an expert. I have never used VLOOKUP until today, and have never used macros or anything slightly exotic. I have always used ordinary formulas such as =((weeklydata!N233/weeklydata!N232)-1)*100 and too much copy and pasting, which I am trying to minimize. How do I work around this?? I hope my explanation is lucid. If not, I will try to clarify. |
#2
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
I need help with the finer points of retaining closing prices for a
group of mutual funds on a weekly and monthly basis. I have a large Excel 2007 file containing 70 worksheets and the solution has to work well within this file. Using data/get external data/from web, I have been able to download closing prices to a new worksheet in the file. For this discussion, suppose A1 is Fund X and A2 is 40.00, the closing price. I then need to populate the 40.00 price to various other worksheets in the file, at the end of every week and month. I know how to do that with a formula directly referencing the worksheet and A2, and I have figured out how to use VLOOKUP to do much the same thing. So far, so good. But I can foresee problems when the day comes that row A in the download worksheet no longer refers to Fund X. Perhaps it has been sold and I am no longer tracking it. In that case, any previously entered formula referring to cell A2 is going to give another value or generate an error. That's not good because all my historical data will show errors or erroneous values as well. Unfortunately, when the formula does its thing, the cell contains a reference back to A2, rather than the 40.00 value per se. If A2 changes, the displayed value in any cell containing a formula referencing A2 changes as well. I want to be able to retain my historical weekly and monthly prices, even though the download worksheet may have been significantly altered or even deleted, for that matter. My Excel skills are modest. Not a novice, but hardly an expert. I have never used VLOOKUP until today, and have never used macros or anything slightly exotic. I have always used ordinary formulas such as =((weeklydata!N233/weeklydata!N232)-1)*100 and too much copy and pasting, which I am trying to minimize. How do I work around this?? I hope my explanation is lucid. If not, I will try to clarify. I have a similar Excel file to track portfolio values and here's what I do. It isn't elegant, but it works for me. Maybe some of the ideas will be useful. I keep monthly sheets for the current year, named "Jan", "Feb", etc.; twelve sheets in all. On each sheet, column A is the ticket symbol and column C is the corresponding share price. I use winstock (http://winstocksw.com/) to get the share prices. Next, I have three sheets: "Share Price", "Num Shares", and "Value". In each of these, D1:O1 contains the last dates of the twelve months of the current year. The rows of these three sheets line up with each other. For example row 4 of "Share Price" is the price of a security for the month identified by the column, "Num Shares" is how many shares of that security are in the portfolio that month, and "Value" is the product. The way my sheets are arranged, D4 is the first month for the first security. Here's how I address the issues you raise. In the "Num Shares" twelve-column array, type in the number of shares for that security for that month. Before purchase or after sale, it's zero or empty or maybe a textual comment. In the "Share Price" sheet, column A is the ticker symbol, starting with A4. In D4 put =IF(N('Num Shares'!D4)0, VLOOKUP($A4,INDIRECT(TEXT(D$1, "Mmm")&"!A:C"),3,FALSE), "") Copy D4 and paste it into the entire array of twelve columns and as many rows as needed. The INDIRECT chooses the monthly sheet based on the date in row 1. The VLOOKUP gets the share price for that security for that month. The IF skips the lookup if the number of shares is zero or non-numeric. This way, the monthly sheets need only have securities that are in the portfolio that month. In the "Value" sheet, put in D4 =IF(N('Num Shares'!D4)0, 'Share Price'!D4*'Num Shares'!D4, "") Copy D4 and paste it into the entire array of twelve columns and as many rows as needed. |
#3
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
Carl
I am not totally clear about what you are trying to do, but, assuming that you are propogating the $40 closing price to other worksheets in cells immediately to the right of the fund name, and the funds are always going to be listed in column A of sheet1 and the closing prices are going to be in column B of sheet1, then vlookup would be a good choice, something like =vlookup(cell to the left, sheet1!A:B,2,false) would give you the the value in column B that corresponds with the fund name, if there is a matching fund name. But, that is not really consistent with what you wrote. From what you posted, it seems like the fund names may be in row 1 and the closing prices in row 2. In that case you would probably need a hlookup, something like =hlookup(cell to the left, sheet1!1:2,2,false) would give you the closing price in row 2 that corresponds to the fund name in row, if there is a matching fund name. If however, your data has fund 1 in A1, its closing price in A2, then fund 2 in A3 and its closing price in A4, then you are screwed. Good luck. Ken On Apr 24, 6:46 am, "Carl LaFong" wrote: I need help with the finer points of retaining closing prices for a group of mutual funds on a weekly and monthly basis. I have a large Excel 2007 file containing 70 worksheets and the solution has to work well within this file. Using data/get external data/from web, I have been able to download closing prices to a new worksheet in the file. For this discussion, suppose A1 is Fund X and A2 is 40.00, the closing price. I then need to populate the 40.00 price to various other worksheets in the file, at the end of every week and month. I know how to do that with a formula directly referencing the worksheet and A2, and I have figured out how to use VLOOKUP to do much the same thing. So far, so good. But I can foresee problems when the day comes that row A in the download worksheet no longer refers to Fund X. Perhaps it has been sold and I am no longer tracking it. In that case, any previously entered formula referring to cell A2 is going to give another value or generate an error. That's not good because all my historical data will show errors or erroneous values as well. Unfortunately, when the formula does its thing, the cell contains a reference back to A2, rather than the 40.00 value per se. If A2 changes, the displayed value in any cell containing a formula referencing A2 changes as well. I want to be able to retain my historical weekly and monthly prices, even though the download worksheet may have been significantly altered or even deleted, for that matter. My Excel skills are modest. Not a novice, but hardly an expert. I have never used VLOOKUP until today, and have never used macros or anything slightly exotic. I have always used ordinary formulas such as =((weeklydata!N233/weeklydata!N232)-1)*100 and too much copy and pasting, which I am trying to minimize. How do I work around this?? I hope my explanation is lucid. If not, I will try to clarify. |
#4
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
Ken:
There was a typo in my original post. The 4th paragraph should begin with "But I can foresee problems when the day comes that column A in the download worksheet no longer refers to Fund X". I had written row A. My download tab has fund ticker symbols in column A and closing prices in the immediately adjacent column B. I need to periodically propagate the column B prices to various other locations in the same Excel file-typically to a "weekly" or "monthly" or "quarterly" performance tab. I download prices daily, but retain only weekly/monthly/quarterly/annual prices. Suppose today's download says A1 is Fund X and A2 is 40.00 and I have price and performance data dating back several months or years for Fund X. I know how to propagate A2 via a direct formula referencing A2 and I discovered yesterday how to do that through VLOOKUP. That is not the problem. Suppose I sell Fund X and therefore no longer continue to download its price. Cell A2 in the downloads tab may then contain the price for a replacement Fund Y. However, I DON'T want to lose the historical info dating back years on the sold Fund X. Since A2 now refers to Fund Y, any formula referring to A2 will be based on Fund Y, not Fund X. Historical info from prior months and years regarding Fund X is overwritten, even though I just sold it. I need to retain the historical info for any fund I may have owned in the past, REGARDLESS of what fund prices I am currently tracking and downloading. Any ideas?? Am I missing something? MyVeryOwnSelf: I am certainly willing to look at your solution. Before spending time developing it, can you give me a layman's description of specifically how it avoids the overwrite problem? As I understand it, you have 15 tabs-January through December, plus Share Price, Num Shares, and Value, and you make new tabs each January. How do you then save the info for prior years, assuming you have solved my overwrite problem?? I hope this clarifies things a bit. |
#5
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
MyVeryOwnSelf:
I am certainly willing to look at your solution. Before spending time developing it, can you give me a layman's description of specifically how it avoids the overwrite problem? As I understand it, you have 15 tabs-January through December, plus Share Price, Num Shares, and Value, and you make new tabs each January. How do you then save the info for prior years, assuming you have solved my overwrite problem?? Since the "Share Price" tab uses VLOOKUP, the order of rows in the monthly tabs doesn't matter. It doesn't matter if stocks are added and deleted from month to month. What matters is: if a particular stock is in the portfolio for a particular month, it has a row _somewhere_ in that month's monthly tab. When I add a new stock to the portfolio, I add a row to the three tabs (Share Price, Num Shares, Value) all at once. Among these three tabs, the order of the rows do match, and there hasn't been any problem about it. At the beginning of the year, I start a new workbook by copying the old one and deleting from the three tabs the rows for the stocks no longer in the portfolio. Lots of constant values are deleted (numbers of shares, all the contents of the monthly tabs) but the formulas carry over. I keep the workbooks from prior years. What I don't do is track trends for individual stocks over many years. I imagine that's possible using links between workbooks, but I haven't worked out the details. Since that kind of info is available generically from lots of web sites, I haven't felt the need. (I do track the portfolio as a whole over the years; just totals.) |
#6
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
MyVeryOwnSelf:
I have set up a dummy file to replicate your method, using your directions as best I can. I have been hacking at it for 2 or 3 hours. I am trying to get a price to come up in Share Price cell D4, which should represent the January closing price for the first security in my list in the Jan tab. I am getting a REF error, not surprisingly. Trying to parse the formula in D4, my guess is that I may have the date reference in Share Price D1 entered incorrectly. I have tried 1/31, Jan 31, 31, 1/31/07, etc with no luck. The month tabs are named Jan, Feb, Mar, Apr, May, Jun, etc. I assume Mmm in the formula refers to the 3 letter month designation, such as Jan, Feb, and I assume the D$1 is what forces INDIRECT to choose Jan rather than Feb. So, what exactly do you have in Share Price D1 and how is row 1 formatted in the Share Price, Num Shares, and Value tabs? |
#7
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
I assume Mmm in the formula refers to the 3 letter month designation,
such as Jan, Feb, and I assume the D$1 is what forces INDIRECT to choose Jan rather than Feb. Right. It takes the "month" component of the date in row 1, expresses it as the three-character name and uses those the characters to identify the tab. If number of shares 0 and the stock isn't in the Jan tab, I'd expect #N/A, not #REF. So, what exactly do you have in Share Price D1 and how is row 1 formatted in the Share Price, Num Shares, and Value tabs? I have formulas to compute the last day of each month, and format those cells as dates: Format Cells Number Date My formulas are more elaborate than necessary, something like this: A1: 2007 [current year as a constant number] D1: =DATE($A$1,2,0) [last day of January; i.e., zeroth day of February] E1: =DATE($A$1,MONTH(D1)+2,0) [last day of February] Copy E1; select F1:O1; and paste. I do this on one of the three sheets; on the others, row 1 refers to that one for end-of-month dates. If there's still a problem, try building up the D4 formula one part at a time and see where things start to go wrong. =TEXT(D$1, "Mmm") [should be Jan] =TEXT(D$1, "Mmm")&"!A:C" [should be Jan!A:C] ='Num Shares'!D4 [should be the number of shares] ='Num Shares'!D40 [should be TRUE] =N('Num Shares'!D4)0 [should be TRUE] =VLOOKUP($A4,INDIRECT(TEXT(D$1, "Mmm")&"!A:C"),3,FALSE) [should be the share price] Combine these two lines for the complete formula: =IF(N('Num Shares'!D4)0, VLOOKUP($A4,INDIRECT(TEXT(D$1, "Mmm")&"!A:C"),3,FALSE), "") |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
stock quote not working | Excel Discussion (Misc queries) | |||
stock quote addin | Excel Discussion (Misc queries) | |||
stock quote add in | Excel Discussion (Misc queries) | |||
stock quote computation | Excel Discussion (Misc queries) | |||
How do I get a refreshable stock quote for S | Excel Discussion (Misc queries) |