I don't have Excel available at home, so I can't see your file. and you did left out most important part of information - the structure of data on sheet quotes! So I have to explain how I would solve a task like this instead simple solution. I hope your Excel isn't older than version 2010.
1. All formulas are much simpler, when using Names and defined Tables. So
a) define cells B8 and C12 as names nDepositCurrency and nTradedPair;
b) define datarange on sheet quotes as table, p.e. tQuotes. NB! when defining table, you have to include column headers, and it will be easier to work with table, when column headers are single word. P.e. TradedPair, SomeOtherColumn, Course, ... And be sure that column TradedPair is leftmost one;
2. Define a Name nDirection = IF(LEFT(nTradedPair,3)=nDepositCurrency,1,0);
3. Define a Name nCourse = VLOOKUP(nTradedPair, tQuotes, COLUMN(tQuotes[[#Headers],[Course]]) - COLUMN(tQuotes[[#Headers],[TradedPair]]) +1,0)
(you can make it simpler when table column TradedPair is in column A)
3. I don't know the structure of table your formula goes into, but it looks like you have there some column with values you want to multiply or divide with course from sheet quotes. So let's assume you define this too as table. p.e. tData, and there is a column Values, and a column Results. Insert into any cell in column Results the formula
=[@Values]*IF(nDirection>0,nCourse,1/nCourse)
When there were no formulas in column Results, or the whole column had same formula in it before, the whole column is updated with new formula.
|