Skip to content

Commit

Permalink
Automatically apply better SUM formula upon adding new round.
Browse files Browse the repository at this point in the history
  • Loading branch information
wtf committed Mar 29, 2017
1 parent 0c7d7cd commit 937af81
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions captable.js
Original file line number Diff line number Diff line change
Expand Up @@ -1141,6 +1141,7 @@ function addRound(capsheet) {
capSheet.addMajorColumn(round);

// Useful locators
var investorBeginRow = capSheet.getCategoryRowCaptable("discount") + 1;
var newInvestorsRow = capSheet.getCategoryRowCaptable("amount raised");
var roundColumn = capSheet.getRoundColumnByName(round);
var totalColumn = capSheet.getRoundColumnByName("TOTAL");
Expand Down Expand Up @@ -1170,6 +1171,11 @@ function addRound(capsheet) {
}
}

// Set SUM Forumla for "amount raised" row so it automatically picks up new rows
var lastCol = capSheet.captablesheet.getLastColumn();
var sumRow = capSheet.captablesheet.getRange(newInvestorsRow, 2, 1, lastCol - 1);
sumRow.setFormula("=SUM(INDIRECT(ADDRESS(" + investorBeginRow + ",COLUMN())):INDIRECT(ADDRESS(ROW()-1,COLUMN())))");

ctLog("Inserting 2 rows into Entities at row: " + i);
// Insert 2 investors into the Entities Sheet
if(i < entitiesNumRows) {
Expand Down

0 comments on commit 937af81

Please sign in to comment.