Syntax Help for Using Logical Operators with the conditionalformatting() Function

Hello.

I am trying to use openxlsx's conditionalformatting() function to highlight instances where, in my dataset, Notes Section 1 and Notes Section 2 BOTH are blank. Openxlsx's documentation--page 16-- says logical operators are possible (in this case AND), but I can't figure out how to properly type the syntax.

This is what I have:

conditionalFormatting(wb, "Sheet1",
                        cols = 26:27,
                        rows = 2:93,
                        rule = 'AND(="")',
                        style = redStyle)

#Save Formatting Change
saveWorkbook(wb, "Both_Notes_Blank.xlsx", TRUE)

Everything should be good to go EXCEPT the rule syntax. Anyone know how to format?

I solved my own question through trial and error. For anyone interested here was what I had to put in the "rule" section: 'AND($Z2="" , $AA2="")'

Z corresponds to the 26th column in Excel; AA corresponds to the 27th.

All other fields were kept the same. I have no idea why "2" is required after the column letter, though

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.