I have many rows that I want to count how many cells are bolded in a Google Sheets. I've looked through plugins and searched for pre-made code snippets (I have no programming skills).
I found a script that does exactly what I want it to do, but the cells it checks and where it outputs the answer is hard coded in located here (answer from user random-parts): Count Bold Cells in Google Sheets Script
I have several hundred rows that I want to know how many, if any, bolded cells, so I would have to make hundreds of separate scripts to use that. I've tried to turn it into a command I can drag/copy on the sheet but that skill is way beyond me.
This is the code that counts all the cells with bold, but the range input and output is hard coded in
var book = SpreadsheetApp.getActiveSpreadsheet();
var sheet = book.getActiveSheet();
var range_input = sheet.getRange("E2:S7");
var range_output = sheet.getRange("G14");
// Get the fontWeights of the range and flatten the array
var cell_styles = range_input.getFontWeights().join().split(",");
// Filter out any value that is not "bold"
var filter_bold = cell_styles.filter(function (e) { return e == "bold" });
// Set the count
range_output.setValue(filter_bold.length);
}
Can someone please provide a script and formula that would allow me to define a range in the sheet and then drag it and have it update?