Why does my conditional formatting not working? - excel-formula

The conditional formatting is
and the worksheet looks like this
Formula for the AL / MC:
=IF(ISBLANK(F7),F8,IF(AND(NOT(ISBLANK(F8)),EXACT(F7,F8)),F7,CONCATENATE(F7,CHAR(10),F8)))
For the above image, I have done the conditional formatting on the worksheet so that different category is highlighted but for the one with AL/MC together is not following the conditional formatting, any idea why is it so?
I tried to redo the conditional formatting and search for solutions online but just cannot get the AL/MC to change accordingly.

Related

VBA Conditional Formatting - xlExpression - Formula

I am new to VBA, and I have searched online but have yet not succeeded and would like to ask kindly for your support. I would like to create an Excel Macro which turns cell entries red, when they do not meet a specific set of conditions (VAT Format).
My research indicates that the following should VBA code could work:
Set condition1 = rng.FormatConditions.Add(xlExpression, Formula1: "XXX")
Defining and setting the format to be applied for each condition
With condition1
.Font.Color = vbBlue
.Font.Bold = True
End With
I have written the conditional formatting code here:
=OR(AND(LEFT(B10,2)="CZ",OR(ISNUMBER(VALUE(RIGHT(B10,8))),ISNUMBER(VALUE(RIGHT(B10,10))),ISNUMBER(VALUE(RIGHT(B10,9)))),OR(LEN(B10)=10,LEN(B10)=11,LEN(B10)=12)),AND(ISNUMBER(VALUE(RIGHT(3))),MID(B10,12,1)=".",ISNUMBER(VALUE(MID(B10,9,3))),MID(B10,8,1)=".",ISNUMBER(VALUE(MID(B10,5,3))),MID(B10,4,1)="-",LEFT(B10,3)="CHE",LEN(B10)=15),AND(LEFT(B10,2)="BG",OR(ISNUMBER(VALUE(RIGHT(B10,9))),ISNUMBER(VALUE(RIGHT(B10,10)))),OR(LEN(B10)=11,LEN(B10)=12)),AND(LEFT(B10,2)="BE",ISNUMBER(VALUE(RIGHT(B10,10))),LEN(B10)=12),AND(LEFT(B10,3)="ATU",ISNUMBER(VALUE(RIGHT(B10,8))),LEN(B10)=11),AND(LEFT(B10,2)="DE",ISNUMBER(VALUE(RIGHT(B10,9))),LEN(B10)=11),OR(AND(LEN(B10)=9,ISNUMBER(VALUE(RIGHT(B10,8))),LEFT(B10,1)="X"),AND(LEN(B10)=9,ISNUMBER(VALUE(LEFT(B10,8))),RIGHT(B10,1)="X"),AND(LEN(B10)=9,LEFT(B10,1)="X",RIGHT(B10,1)="X",ISNUMBER(VALUE(MID(B10,2,7))))),AND(LEFT(B10,2)="EL",ISNUMBER(VALUE(RIGHT(B10,9))),LEN(B10)=11),AND(LEFT(B10,2)="EE",ISNUMBER(VALUE(RIGHT(B10,9))),LEN(B10)=11),AND(LEFT(B10,2)="DK",ISNUMBER(VALUE(RIGHT(B10,8))),LEN(B10)=10),AND(LEFT(B10,2)="HR",ISNUMBER(VALUE(RIGHT(B10,11))),LEN(B10)=13),AND(LEFT(B10,2)="GB",ISNUMBER(VALUE(RIGHT(B10,9))),LEN(B10)=11),OR(AND(ISNUMBER(VALUE(RIGHT(B10,9))),NOT(ISNUMBER(VALUE(MID(B10,3,1)))),LEFT(B10,2)="FR",LEN(B10)=13),AND(ISNUMBER(VALUE(RIGHT(B10,9))),NOT(ISNUMBER(VALUE(LEFT(B10,4)))),LEFT(B10,2)="FR",LEN(B10)=13),AND(ISNUMBER(VALUE(RIGHT(B10,10))),NOT(ISNUMBER(VALUE(LEFT(B10,3)))),LEFT(B10,2)="FR",LEN(B10)=13),AND(ISNUMBER(VALUE(RIGHT(11))),LEFT(B10,2)="FR",LEN(B10)=13)),AND(LEFT(B10,2)="FI",ISNUMBER(VALUE(RIGHT(B10,8))),LEN(B10)=10),AND(LEN(B10)=14,LEFT(B10,2)="NO",ISNUMBER(VALUE(MID(B10,3,9))),RIGHT(B10,3)="MVA"),AND(LEN(B10)=14,LEFT(B10,2)="NL",ISNUMBER(VALUE(MID(B10,3,9))),MID(B10,12,1)="B",ISNUMBER(VALUE(RIGHT(B10,2)))),AND(LEFT(B10,2)="LU",ISNUMBER(VALUE(RIGHT(B10,8))),LEN(B10)=10),AND(LEFT(B10,2)="IT",ISNUMBER(VALUE(RIGHT(B10,11))),LEN(B10)=13),AND(LEFT(B10,2)="IL",ISNUMBER(VALUE(RIGHT(B10,8))),ISNUMBER(VALUE(RIGHT(B10,8)))),OR(AND(NOT(ISNUMBER(VALUE(RIGHT(B10,2)))),ISNUMBER(VALUE(LEFT(B10,7))),LEN(B10)=9),AND(ISNUMBER(VALUE(MID(B10,3,4))),ISNUMBER(VALUE(LEFT(B10,1))),NOT(ISNUMBER(RIGHT(B10,1))),NOT(ISNUMBER(VALUE(MID(B10,2,0)))),LEN(B10)=8),AND(NOT(ISNUMBER(VALUE(RIGHT(B10,1)))),ISNUMBER(VALUE(LEFT(B10,7))),LEN(B10)=8)),AND(LEFT(B10,2)="HU",ISNUMBER(VALUE(RIGHT(B10,8))),LEN(B10)=10),AND(ISNUMBER(VALUE(RIGHT(B10,8))),LEFT(B10,2)="MT",LEN(B10)=10),OR(AND(ISNUMBER(VALUE(RIGHT(12))),LEFT(B10,2)="LT",LEN(B10)=14),AND(ISNUMBER(VALUE(RIGHT(B10,9))),LEFT(B10,2)="LT",LEN(B10)=11)),AND(ISNUMBER(VALUE(RIGHT(B10,11))),LEFT(B10,2)="LV",LEN(B10)=13),AND(NOT(ISNUMBER(RIGHT(B10,1))),ISNUMBER(VALUE(MID(B10,3,8))),LEFT(B10,2)="CY",LEN(B10)=11),AND(ISNUMBER(VALUE(RIGHT(B10,10))),LEFT(B10,2)="SK",LEN(B10)=12),AND(ISNUMBER(VALUE(RIGHT(B10,7))),LEFT(B10,2)="SI",LEN(B10)=10),AND(ISNUMBER(VALUE(RIGHT(B10,10))),LEFT(B10,2)="SE",LEN(B10)=14),OR(AND(ISNUMBER(VALUE(RIGHT(B10,2))),LEFT(B10,2)="RO",LEN(B10)=4),AND(ISNUMBER(VALUE(RIGHT(B10,3))),LEFT(B10,2)="RO",LEN(B10)=5),AND(ISNUMBER(VALUE(RIGHT(B10,4))),LEFT(B10,2)="RO",LEN(B10)=6),AND(ISNUMBER(VALUE(RIGHT(B10,5))),LEFT(B10,2)="RO",LEN(B10)=7),AND(ISNUMBER(VALUE(RIGHT(B10,6))),LEFT(B10,2)="RO",LEN(B10)=8),AND(ISNUMBER(VALUE(RIGHT(B10,7))),LEFT(B10,2)="RO",LEN(B10)=9),AND(LEN(B10)=10,LEFT(B10,2)="RO",ISNUMBER(VALUE(RIGHT(B10,8)))),AND(ISNUMBER(VALUE(RIGHT(B10,9))),LEFT(B10,2)="RO",LEN(B10)=11),AND(ISNUMBER(VALUE(RIGHT(B10,10))),LEFT(B10,2)="RO",LEN(B10)=12)),AND(ISNUMBER(VALUE(MID(B10,3,9))),LEFT(B10,2)="PT",LEN(B10)=11),AND(ISNUMBER(VALUE(MID(B10,3,10))),LEFT(B10,2)="PL",LEN(B10)=12))
How can I incorporate my conditions into the VBA code with conditional formatting turning cell entries red if they do not meet the above conditions?
Your support would be highly appreciated. Many thanks.
There are two ways to modify the format of a cell: conditional formatting and VBA.
Using VBA, you write a macro like this:
IF InStr("CZ", Range("B10").Value) ...
THEN Range("..."). ' change the background colour
Using conditional formatting, you might apply a formula (or another rule) on a cell.
What you are doing, is writing a VBA macro where you, instead of colouring the cell, you want to apply conditional formatting, based on a complicated formula, which should then take care of the colouring.
Why are you making that combination?

Excel - Conditional Formatting not working because cell has an existing formula

My conditional formatting rules I am using to highlight a row with value = 1 dont seem to be working because there is an existing formula in the cell. So I assume excel is seeing the formula but not the actual value and not highlighting it. Is there a way around this? I tried =$A2=VALUE(1) and it highlighted some rows but no the correct one.
You can do this by going to Conditional Formatting -> Rules to Highlight Cells -> Equals. Then, you enter 1 and select the preferred formatting.
I hope that I translated the menu correctly; I use Excel in the German language since it's my mothertongue.

Conditional formatting on cells to check if they are equal

I am trying to apply a formula to change color of both cells if they are not equal and if they are equal.
I tried conditional formatting in excel but it did not give me the required solution.
I want something like below:
please click to see the image
Thanks in advance.
I think you need to apply dollars in the conditional formatting formula. The dollars need to be in front so the formatting is applied properly.
Select the range you want to apply conditional formatting > Conditional formatting > New Rule > Use a formula to determine which cells to format:
And do it again but then with <> in between and make it red.
There you go.

How to create Excel Conditional Formatting

I normally have no issues creating simple conditional formatting formulas in Excel.
But the following formula works fine in a normal cell but not when used as a conditional formatting formula. What can be the problem?
=AND(INDIRECT(ADDRESS(ROW();COLUMN($B:$B)))="";INDIRECT(ADDRESS(ROW()-1;COLUMN($B:$B)))<>"")
Example:
The indirection seems unnecessary. Have you tried this?
=AND($B2="";$B1<>"")

Conditional formatting using vlookup or Countifs

I am trying to use conditional formatting to see if an entry on A1-A10 is found on Sheet2!A1-A10. If it is then I want it to apply conditional formatting for every cell that it is found in on A1-A10. Every solution I have found so far is asking to use a < or > 0 which doesn't work.
This is what I've started with. I know this doesn't work but I am not sure where to go from here.
=VLOOKUP(Sheet2!A1:Sheet2!A10), $A$1:$A$10, 1, FALSE)
This works:
=NOT(ISERROR(VLOOKUP(A1;Sheet2!$A$1:$A$10;1;FALSE)))
When you add a formula for conditional formatting, you write it as if it concernes only the first cell of the range, i.e. A1 in this case, although the formatting rule is applied to A1:A10.

Resources