Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Pradeep… You could use an <a href="https://developers.google.com/apps-script/" rel="nofollow">apps script</a> that is <a href="https://developers.google.com/apps-script/understanding_triggers" rel="nofollow">triggered</a> to run when a new row is added to your spreadsheet.</p> <p>The script below is modifed from one I used to insert an IF formula into a cell in the last row that evaluate a value in another column.</p> <p>Quickly:</p> <ul> <li>Add the ID of your spreadsheet.</li> <li>Add the name of your sheet.</li> <li>I made a variable for the column I will be evaluating and the column where I will be adding the formula. You may or may not need this.</li> <li>Use <a href="https://developers.google.com/apps-script/reference/spreadsheet/range?hl=en#getLastRow%28%29" rel="nofollow">.getLastRow()</a> to get the last row of the spreadsheet.</li> <li>Create a range, which will pinpoint the cell I want to evaluate and the cell where I will add the formula</li> <li>Create a variable for the formula.</li> <li>Get the cell I will be adding the formula to.</li> <li>Use <a href="https://developers.google.com/apps-script/reference/spreadsheet/range?hl=en#setFormula%28String%29" rel="nofollow">.setFormula</a> to add the formula to that cell. </li> </ul> <p>This could probably be more efficient, and you might not be able to use this straight out the box, but it will give you an idea of some of the mechanisims available.</p> <p>Chris K.</p> <pre><code> // evaluate project type and set identifier function addCountIfFormulaToCell(){ // add the id of your spreadsheet here var sss = SpreadsheetApp.openById('0ApI9xmBd0k....'); // add the name of the sheet here var ss = sss.getSheetByName('Sheet1'); // column you want to evaluate for the formula var columnToEvaluateAgainst = "B"; // column you want to add the formula to var columnToAddFormulaTo = "C"; // identifies the last row var lastRow = ss.getLastRow(); // is the cell to evaluate in the last row var evaluateThisCell = columnToEvaluateAgainst + lastRow; // is the cell that gets the forumla in the last row var addFormulaToThisCell = columnToAddFormulaTo + lastRow; // this is my formula var projectFormula = "THIS IS MY FORMULA"; // grabs the cell that gets the forumla in the last row var ssCellToGetFormula = ss.getRange(addFormulaToThisCell); // sets the formula to the cell in the last row ssCellToGetFormula.setFormula(projectFormula); }; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload