Skip to content

Conditional formatting based on other column value #2323

Discussion options

You must be logged in to vote

the solution is:
" // Convert column indices to letters for A1-style referencing
string statusXColumnLetter = XLHelper.GetColumnLetterFromNumber(StatusXColumn);
string statusYColumnLetter = XLHelper.GetColumnLetterFromNumber(StatusYColumn);

                    var StatusXRange = worksheet.Range(2,StatusXColumn, worksheet.LastRowUsed().RowNumber(),StatusXColumn);

                    string formula = $"AND(${statusXColumnLetter}2<>\"\",${statusYColumnLetter}2<>${statusXColumnLetter}2)";
                    StatusXRange.AddConditionalFormat().WhenIsTrue(formula).Font.FontColor = XLColor.Red;

`

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by BOIOpenBanking
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant