Search code examples
google-apps-scriptgoogle-sheetsgoogle-sheets-formula

Conditional Formatting: Change color of Entire Row if any column value changes (Google Sheets)


enter image description hereGood evening,

I'm attempting to find the best solution for Changing an Entire row's font color (red) if any cell value changes (updated or inserted). Edited comment: I'm also open utilizing a custom formula in with Apps Script.

I have also included an Attachment for clarification. Any assistance is greatly appreciated. Thanks!

Initially, I created a Custom Formula (below) that changes all font color to red when the Quantity column (G) is Greater than zero. But it needs to be modified to handle any cell value changes within an entire row.

Apply to any range: A5:M13,A16:M23,A26:M28,A31:M38 
Custom Formula is: = $G5:$G > 0

Solution

  • Detect Changes and Change Font Color of Affected Row. (Alternate Solution)

    It is very tricky to detect changes using only formulas. Alternate solution is using Apps Script. I have created a simple script for you to implement this gracefully.

    Code :

    function onEdit(e) {
    var changedRange = e.range;
    var changedRow = changedRange.getRow();
    var ss = SpreadsheetApp.getActiveSpreadsheet();
    var sheet = ss.getActiveSheet();
    var transformRange = sheet.getRange(changedRow, 1, 1, sheet.getLastColumn());
    transformRange.setFontColor("Red");
    }
    
    

    How it works on your Sheet:

    image

    Reference:

    onEdit

    setFontColor

    Please let me know if you need clarification with the Apps Script and how to implement this on your project