Forum Discussion
Per
Jan 23, 2025Copper Contributor
Sorting numbers
Hi, I have a excel sheet with x number of columns. I have formated the rows so that if there is a specific number it is marked in red. See picture below. The numbers that are marked are Top row ...
- Jan 24, 2025
The formula needs to match the logic used in your Conditional Formatting rules. Based on your screenshots, I believe you meant to say the rule for the Top Row is "0 - 2 and 9 - 13. So, numbers 3-8 shall not be marked".
Also, I think the logic just needs to be reversed from what's already been suggested. Try either:
=SUM(N(NOT(BYCOL((A1:AI3<{3;1;2})+(A1:AI3>{8;5;6}),OR))))
Or:
=SUM(BYCOL((A1:AI3>{2;0;1})*(A1:AI3<{9;6;7}),PRODUCT))
See attached...
SergeiBaklan
Jan 24, 2025MVP
To play with OfficeScript, number of columns for which no one cell is marked by color
function main(workbook: ExcelScript.Workbook) {
const data = workbook.getNamedItem("data").getRange()
const nColumns = data.getColumnCount()
const notFilled = "#FFFFFF"
const columns = Array.from(Array(nColumns).keys())
const count = columns
.reduce((a, v) => a +
Number((data.getColumn(v).getFormat().getFill().getColor() == notFilled)),
0)
data.getLastCell().getOffsetRange(0, 2).setValue("Not marked " + count)
}
- PerJan 24, 2025Copper Contributor
Thank you Sergei,
Your code seems to accually do the job I am looking for. Nest step is to implement it in my sheet. Any possibillity to help me how to do that?