Forum Discussion
Excel conditional formatting formula not working as expected
Could you attach a small sample workbook demonstrating the problem (without sensitive data), or if that is not possible, make it available through OneDrive, Google Drive, Dropbox or similar?
- sleiboDec 03, 2023Copper Contributor
Thank you Hans. Please see:
https://www.dropbox.com/scl/fo/ebou2bzznsluxesftn5c2/h?rlkey=mg2ehx55asxqccrgggizj7q5v&dl=0
Column R contains the calculated field that I would like to conditionally format. I have copied the values from column R to column S and applied conditional formatting to both R and S. It works as intended in column S, but not in column R.
Note that the basic spreadsheet was downloaded from our payroll provider, so columns A-O contain some weird formatting.
PS I don't see a way to attach files to this forum directly, is that correct?
- HansVogelaarDec 03, 2023MVP
Most users cannot attach files in this forum; some can but I don't know the criteria.
Your formula switches from returning number values such as 6 or 8 in row 2 to returning text values such as "6" or "8" in row 3 and below; that's why the conditional formatting doesn't work.
You can simplify the formula in R2 to
=IF(D2="H",IF(Q2<3,1,IF(Q2>4,6,Q2)),IF(D2="S",IF(Q2<2,3,IF(Q2>3,8,6)),"none"))
then fill down.
- sleiboDec 03, 2023Copper ContributorThank you Hans, that worked! But why is the format of the results of my formula different in different cells, even though I formatted them all as "General"?