2021年3月26日星期五

How to use Case Select in GOOGLE SHEET

I'm trying to enter the formula in cell A4 in sheet1 depending on value at cell AA1 but not working and help me if cell AA1 is blank or N/A or NEW then do notthing.

function setFormulaspercase(){     var ss = SpreadsheetApp.getActive()               var cell = ss.getActiveCell()     var cellcase = ("AA1");     var formulaCell = ("A4");        if (cellcase == 'A') {    SpreadsheetApp.getActiveSheet().getRange(formulaCell).setFormula("=QUERY(\'Sheet2\'!B4:U,SELECT B,G,C,H,L,O,J,D,S,T)");        if (cellcase == 'B') {    SpreadsheetApp.getActiveSheet().getRange(formulaCell).setFormula("=QUERY(\'Sheet2\'!B4:U,SELECT B,C,G,H,L,O,J,D,S,T)");          if (cellcase == 'C') {    SpreadsheetApp.getActiveSheet().getRange(formulaCell).setFormula("=QUERY(\'Sheet2\'!B4:U,SELECT B,C,G,L,H,O,J,D,S,T)");  `  
https://stackoverflow.com/questions/66827356/how-to-use-case-select-in-google-sheet March 27, 2021 at 10:00AM

没有评论:

发表评论