Conditional formatting gone wrong

RAJESH1960

Banned for repeated rules violations
Joined
Mar 26, 2020
Messages
2,313
Office Version
  1. 2019
Platform
  1. Windows
Hello guys

I am getting a few problems in my sheet. 1. Rows 5 & 7 are matched but selected rows are colored as rule applied in conditional formatting, which it shouldn’t. 2. Row 6 is matched but it is showing Debit / Credit Not Matching.

Otherwise, all other remaining rows are correct.
Query Amount mismatch wrong formula.xlsx
ABCDEFGHIJKLMNO
1HelpDate*Type*OptionalOptionalLedger Name* Amt* Ledger Name* Amt* Ledger Name* Amt* Ledger Name Amt Total
2Matched03-04-2021PaymentKotak Bank2000January-1000February-10000.00
3Matched05-04-2021PaymentKotak Bank5664February-4800March-8640.00
4Matched05-04-2021ReceiptKotak Bank-42000March20000April220000.00
5Matched05-04-2021ReceiptKotak Bank-43April5May5March330.00
6Debit/Credit Not Matching06-04-2021ReceiptKotak Bank-16376May16376.42June-0.420.00
7Matched08-04-2021PaymentKotak Bank10000June-5000July-50000.00
8Debit/Credit Not Matching08-04-2021PaymentKotak Bank9000June-5000July-5000-1000.00
PasteData
Cell Formulas
RangeFormula
A2:A8A2=IF(B2&C2&F2&G2&H2&I2="","",IF(O2=0,"Matched","Debit/Credit Not Matching"))
O2:O8O2=IF(B2="","",G2+I2+K2+M2)
Cells with Conditional Formatting
CellConditionCell FormatStop If True
1:1048576Expression=AND($O2<>0,ISEVEN(COLUMN(B2)))textNO
E2:M7,F8,H8:K8Expression=AND($N2<>0,ISEVEN(COLUMN(B2)))textNO
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
Earlier I had selected the whole sheet. But after selecting this range F2:M100 and then after applying the rule I got it partly correct. Still the row 6 is showing Not Matching whereas it has to show matched.
Query Amount mismatch wrong formula.xlsx
ABCDEFGHIJKLMNO
1HelpDate*Type*OptionalOptionalLedger Name* Amt* Ledger Name* Amt* Ledger Name* Amt* Ledger Name Amt Total
2Matched03-04-2021PaymentKotak Bank2000January-1000February-10000.00
3Matched05-04-2021PaymentKotak Bank5664February-4800March-8640.00
4Matched05-04-2021ReceiptKotak Bank-42000March20000April220000.00
5Matched05-04-2021ReceiptKotak Bank-43April5May5March330.00
6Debit/Credit Not Matching06-04-2021ReceiptKotak Bank-16376May16376.42June-0.420.00
7Matched08-04-2021PaymentKotak Bank10000June-5000July-50000.00
8Debit/Credit Not Matching08-04-2021PaymentKotak Bank9000June-5000July-5000-1000.00
9  
PasteData
Cell Formulas
RangeFormula
A2:A9A2=IF(B2&C2&F2&G2&H2&I2="","",IF(O2=0,"Matched","Debit/Credit Not Matching"))
O2:O9O2=IF(B2="","",G2+I2+K2+M2)
Cells with Conditional Formatting
CellConditionCell FormatStop If True
F2:M9Expression=AND($O2<>0,ISEVEN(COLUMN(B2)))textNO
 
Upvote 0
as the formula starts at row2 , so does the selection

in a new column row 2 put the formula, and copy to the same range , see if you get true false correctly
=AND($O2<>0,ISEVEN(COLUMN(B2)))

see if you get TRUE False

Column O is fixed with the $
BUT B2 will move

So only ROW 6 & 8 can be possibly TRUE as the the others have a zero in column O

then ISEVEN(COLUMN(B2)))
Means only , B is Even , so thats going to be column F as thats the start of selection
then every other column F,H,J,L etc

so its working as expected

BUT WHAT do you want to highlight and why ?


Book5
ABCDEFGHIJKLMNOPQRSTUVWX
1HelpDate*Type*OptionalOptionalLedger Name* Amt* Ledger Name* Amt* Ledger Name* Amt* Ledger Name Amt Total
2Matched44289PaymentKotak Bank2000January-1000February-10000FALSEFALSEFALSEFALSEFALSEFALSEFALSE
3Matched44291PaymentKotak Bank5664February-4800March-8640FALSEFALSEFALSEFALSEFALSEFALSEFALSE
4Matched44291ReceiptKotak Bank-42000March20000April220000FALSEFALSEFALSEFALSEFALSEFALSEFALSE
5Matched44291ReceiptKotak Bank-43April5May5March330FALSEFALSEFALSEFALSEFALSEFALSEFALSE
6Debit/Credit Not Matching44292ReceiptKotak Bank-16376May16376.42June-0.427.27751E-14TRUEFALSETRUEFALSETRUEFALSETRUE
7Matched44294PaymentKotak Bank10000June-5000July-50000FALSEFALSEFALSEFALSEFALSEFALSEFALSE
8Debit/Credit Not Matching44294PaymentKotak Bank9000June-5000July-5000-1000TRUEFALSETRUEFALSETRUEFALSETRUE
9  TRUEFALSETRUEFALSETRUEFALSETRUE
Sheet1
Cell Formulas
RangeFormula
Q2:W9Q2=AND($O2<>0,ISEVEN(COLUMN(B2)))
A2:A9A2=IF(B2&C2&F2&G2&H2&I2="","",IF(O2=0,"Matched","Debit/Credit Not Matching"))
O2:O9O2=IF(B2="","",G2+I2+K2+M2)
 
Last edited:
Upvote 0
Hi Rajesh1960,

The highlit cells were set using manual fill, not Conditional Formatting. Are the ones in yellow the ones you want highlighted apart from row 6?

Row 6 will be highlighted because O6 is not zero, it contains 0.000000000000073 so you may want to use the ROUND function.
 
Upvote 0
Solution
as the formula starts at row2 , so does the selection

in a new column row 2 put the formula, and copy to the same range , see if you get true false correctly
=AND($O2<>0,ISEVEN(COLUMN(B2)))

see if you get TRUE False

Column O is fixed with the $
BUT B2 will move

So only ROW 6 & 8 can be possibly TRUE as the the others have a zero in column O

then ISEVEN(COLUMN(B2)))
Means only , B is Even , so thats going to be column F as thats the start of selection
then every other column F,H,J,L etc

so its working as expected

BUT WHAT do you want to highlight and why ?


Book5
ABCDEFGHIJKLMNOPQRSTUVWX
1HelpDate*Type*OptionalOptionalLedger Name* Amt* Ledger Name* Amt* Ledger Name* Amt* Ledger Name Amt Total
2Matched44289PaymentKotak Bank2000January-1000February-10000FALSEFALSEFALSEFALSEFALSEFALSEFALSE
3Matched44291PaymentKotak Bank5664February-4800March-8640FALSEFALSEFALSEFALSEFALSEFALSEFALSE
4Matched44291ReceiptKotak Bank-42000March20000April220000FALSEFALSEFALSEFALSEFALSEFALSEFALSE
5Matched44291ReceiptKotak Bank-43April5May5March330FALSEFALSEFALSEFALSEFALSEFALSEFALSE
6Debit/Credit Not Matching44292ReceiptKotak Bank-16376May16376.42June-0.427.27751E-14TRUEFALSETRUEFALSETRUEFALSETRUE
7Matched44294PaymentKotak Bank10000June-5000July-50000FALSEFALSEFALSEFALSEFALSEFALSEFALSE
8Debit/Credit Not Matching44294PaymentKotak Bank9000June-5000July-5000-1000TRUEFALSETRUEFALSETRUEFALSETRUE
9  TRUEFALSETRUEFALSETRUEFALSETRUE
Sheet1
Cell Formulas
RangeFormula
Q2:W9Q2=AND($O2<>0,ISEVEN(COLUMN(B2)))
A2:A9A2=IF(B2&C2&F2&G2&H2&I2="","",IF(O2=0,"Matched","Debit/Credit Not Matching"))
O2:O9O2=IF(B2="","",G2+I2+K2+M2)
I want the row containing amounts which are not matching to be highlighted. I have corrected it but now my only question is why is the 6th row highlighted even when the sum of the amount is 0.
Query Amount mismatch wrong formula.xlsx
ABCDEFGHIJKLMNO
1HelpDate*Type*OptionalOptionalLedger Name* Amt* Ledger Name* Amt* Ledger Name* Amt* Ledger Name Amt Total
2Matched03-04-2021PaymentKotak Bank2000January-1000February-10000.00
3Matched05-04-2021PaymentKotak Bank5664February-4800March-8640.00
4Matched05-04-2021ReceiptKotak Bank-42000March20000April220000.00
5Matched05-04-2021ReceiptKotak Bank-43April5May5March330.00
6Debit/Credit Not Matching06-04-2021ReceiptKotak Bank-16376May16376.42June-0.420.00
7Matched08-04-2021PaymentKotak Bank10000June-5000July-50000.00
8Debit/Credit Not Matching08-04-2021PaymentKotak Bank9000June-5000July-5000-1000.00
PasteData
Cell Formulas
RangeFormula
A2:A8A2=IF(B2&C2&F2&G2&H2&I2="","",IF(O2=0,"Matched","Debit/Credit Not Matching"))
O2:O8O2=IF(B2="","",G2+I2+K2+M2)
Cells with Conditional Formatting
CellConditionCell FormatStop If True
G2:O602Expression=AND($O2<>0,ISEVEN(COLUMN(B2)))textNO
.
The reason for the highlight is I can make the required changes if there is a mistake in the total of that particular row. Like, If I correct the amount in cell G8 from 9000 to 10000 the formatting disappears.
 
Last edited:
Upvote 0
You were right
Hi Rajesh1960,

The highlit cells were set using manual fill, not Conditional Formatting. Are the ones in yellow the ones you want highlighted apart from row 6?

Row 6 will be highlighted because O6 is not zero, it contains 0.000000000000073 so you may want to use the ROUND function.
You are right. Round function solved the problem. Thanks.
 
Upvote 0

Forum statistics

Threads
1,223,155
Messages
6,170,403
Members
452,325
Latest member
BlahQz

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top