0

colA에 이름 목록이 포함 된 Google 드라이브 스프레드 시트에 간단한 스프레드 시트가 있습니다. ColB에서 ColB까지는 빈 셀을 채 웁니다.행의 셀 B-J가 비어 있으면 colA의 셀 강조 표시

ColJ를 통해 ColB에 입력 된 데이터가 없을 때 ColA에서 셀의 배경색을 변경하고 싶지만이를 수행 할 방법이 없습니다.

답변

1

조건부 서식을 사용하면이 기능이 제공되지만 다른 셀을 참조 할 수는 없다고 생각할 수 있습니다. (Excel과 달리)

다음은 작업을 수행 할 스크립트입니다. (Google 애플리케이션 스크립트를 처음 사용하는 경우, this introduction를 참조하십시오.) COLUMNA에서

/** 
* The onEdit() function, when defined, is automatically invoked whenever the 
* spreadsheet is edited. (Not every change is an "edit".) 
* 
* If all of the "fill in the blanks" columns are empty, set the 
* background color of the name column in that row. 
*/ 
function onEdit(event) { 
    var row = event.range.getRow(); 
    var sheet = event.range.getSheet(); 
    var cellA = sheet.getRange(row,1); 
    // Get the range of cells B-J that make up the "fill in the blanks" range... 
    var fillInTheBlanks = sheet.getRange(row, 2, 1, 9) 
          .getValues()[0] // ... get values in 0-th row 
          .join('');  // ... and join into one string 

    // Check that string - if it is empty, the range was blank, 
    // and we should set the background color to, say, yellow. 
    if (fillInTheBlanks.length == 0) { 
    cellA.setBackground("yellow"); 
    } 
    // On the other hand, if the string was NOT blank, there is something 
    // in the "fill in the blanks" range, so we will clear the background. 
    else { 
    cellA.setBackground("white"); 
    } 
} 

/** 
* The onOpen() function, when defined, is automatically invoked whenever the 
* spreadsheet is opened. 
* 
* Iterates through all rows in spreadsheet, faking onEdit triggers, as if 
* each name has been edited. 
*/ 
function onOpen() { 
    var sheet = SpreadsheetApp.getActiveSpreadsheet(); 
    var lastRow = sheet.getLastRow(); 
    for (var row=1; row <= lastRow; row++) { 
    onEdit({range:sheet.getRange('A'+row)}); 
    } 
}; 
0

지우기 서식을, COLUMNA 및 형식, 조건부 서식 ..., 사용자 정의 공식은 셀 서식 ... 경우을 선택하고 :

=and(A1<>"",counta(B1:J1)=0) 

그런 다음 완료 선택의 채우기 및 를 선택합니다.