I'm making a daytrading spreadsheet and I want to use formulas exclusively because I want to learn more about spreadsheet programming. I have a column called "Investment" which takes the price of a stock at the point of entry and multiplies it by the number of shares I've bought. The problem is that even though it works, it recalculates the values for the whole column every time I enter info in a new row. How can I modify my formula so that it only calculates the investment for the current row? Here's my code:
function INVESTMENT(entry, quantity) {
var resultArray = [];
for(row = 0; row < entry.length; row++) {
resultArray.push(Math.abs(entry[row] * quantity[row]));
}
return resultArray;
}