I have some openoffice calc sheets where some rows are maked with the font color red. All other rows are in the default font color.

Can I use the font color of a cell within a formula to react to this or is this impossible?

Example: Assuming I have column A with red and black cells, how would I create a column B that has "1" if A is red and "0" if A is black?

  • 1
    Yes, it's possible. You might want to start here – Raystafarian Jul 25 '13 at 9:32
  • 1
    This points to the STYLE command that lets me set the color. I'm looking for something that lets me read the color to use in formulas. I'm updating the question to make this clearer... – 576i Jul 25 '13 at 12:53
  • Use the style function to pull the color from the adjacent cell. Like an if(T(style( type function or similar – Raystafarian Jul 25 '13 at 13:10
  • 2
    AFAIK this doesn't work. STYLE() returns 0 independet of the the current style. Additionally, the documentation states explcitely: "There is no direct way to determine (in a formula) what formatting has been applied to a cell." – tohuwawohu Aug 10 '13 at 11:03
  • This post explains how to do it via user-defined macro e.g. =IF(CELL_BACKCOLOR(SHEET(); ROW(); 1) = 0; "I am black"; "I have another color"). – dma_k Jun 7 '17 at 10:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.