SOLVED

Conditional Formatting on Concatenate Formula

%3CLINGO-SUB%20id%3D%22lingo-sub-2474262%22%20slang%3D%22en-US%22%3EConditional%20Formatting%20on%20Concatenate%20Formula%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2474262%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20Team%2C%20I%20have%20successfully%20created%20a%20conditional%20formatting%20concatenate%20formula%2C%20however%20when%20the%20columns%20are%20copied%20and%20new%20ones%20are%20inserted%2C%20the%20conditional%20formatting%20cells%20are%20using%20the%20old%20columns%20and%20not%20basing%20them%20on%20the%20new%20columns.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EFor%20example%3A%20I%20copy%20columns%20AY%20and%20AZ%20into%20BB%20and%20BC%2C%20however%20the%20formula%20is%20picking%20up%20AY%20and%20AZ%20still.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20have%20attempted%20to%20resolve%20this%20issue%20numerous%20times%2C%20however%20I%20have%20had%20no%20luck.%20Please%20find%20print%20screens%20attached.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3DVLOOKUP(CONCATENATE(%24BB3%2C%24BC3)%2CLegend!%24G%242%3A%24H%2438%2C2%2CFALSE)%3D%22Blank%22%3C%2FP%3E%3CP%3E%3DVLOOKUP(CONCATENATE(%24BB3%2C%24BC3)%2CLegend!%24G%242%3A%24H%2438%2C2%2CFALSE)%3D%22R%22%3C%2FP%3E%3CP%3E%3DVLOOKUP(CONCATENATE(%24BB3%2C%24BC3)%2CLegend!%24G%242%3A%24H%2438%2C2%2CFALSE)%3D%22AR%22%3C%2FP%3E%3CP%3E%3DVLOOKUP(CONCATENATE(%24BB3%2C%24BC3)%2CLegend!%24G%242%3A%24H%2438%2C2%2CFALSE)%3D%22A%22%3C%2FP%3E%3CP%3E%3DVLOOKUP(CONCATENATE(%24BB3%2C%24BC3)%2CLegend!%24G%242%3A%24H%2438%2C2%2CFALSE)%3D%22AG%22%3C%2FP%3E%3CP%3E%3DVLOOKUP(CONCATENATE(%24BB3%2C%24BC3)%2CLegend!%24G%242%3A%24H%2438%2C2%2CFALSE)%3D%22G%22%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22milo1234_0-1624439093585.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F290622i0ABA3B9ED6424A27%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22milo1234_0-1624439093585.png%22%20alt%3D%22milo1234_0-1624439093585.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22milo1234_1-1624439101251.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F290623iCF1F44768E1BF81C%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22milo1234_1-1624439101251.png%22%20alt%3D%22milo1234_1-1624439101251.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22milo1234_2-1624439107441.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F290624i10CF16CC52B0D6E9%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22milo1234_2-1624439107441.png%22%20alt%3D%22milo1234_2-1624439107441.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2474262%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EFormulas%20and%20Functions%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EOffice%20365%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2475017%22%20slang%3D%22en-US%22%3ERe%3A%20Conditional%20Formatting%20on%20Concatenate%20Formula%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2475017%22%20slang%3D%22en-US%22%3EHi%2C%20I'm%20a%20little%20confused%20about%20the%20issue.%20You%20say%2C%20%22I%20copy%20columns%20AY%20and%20AZ%20into%20BB%20and%20BC%2C%20however%20the%20formula%20is%20picking%20up%20AY%20and%20AZ%20still.%22%20but%20then%20the%20formula%20you%20give%20is%20%22%3DVLOOKUP(CONCATENATE(%24BB3%2C%24BC3)%2CLegend!%24G%242%3A%24H%2438%2C2%2CFALSE)%3D%22Blank%22%22%3CBR%20%2F%3EThat%20said%2C%20I%20think%20you%20problem%20is%20the%20%24%20in%20the%20Concatenate%20formula.%20On%20one%20hand%20you%20are%20using%20it%20to%20force%20both%20columns%20to%20concatenate%20the%20correct%20cells%20but%20then%20when%20you%20copy%20to%20new%20columns%20it%20is%20preventing%20it%20from%20looking%20at%20and%20acting%20on%20the%20new%20columns.%3CBR%20%2F%3EIF%20you%20have%20blank%20columns%20to%20the%20left%20and%20right%20of%20each%20set%20as%20you%20show%20above%20you%20could%20make%20the%20formula%3A%3CBR%20%2F%3E%3DVLOOKUP(CONCATENATE(BA3%3ABC3)%2CLegend!%24G%242%3A%24H%2438%2C2%2CFALSE)%3D%22Blank%22%3CBR%20%2F%3E%3CBR%20%2F%3ESo%20in%20this%20solution%20cell%20BB3%20would%20apply%20the%20above%20formula%20and%20concatenate%20BA3%3ABC3%20which%20would%20be%20blank%20%26amp%3B%20BB3%20%26amp%3B%20BC3%20and%20give%20what%20you%20want.%20Then%20BC3%20would%20concatenate%20the%20offset%2Frelative%20cells%20BB3%3ABD3%2C%20but%20again%20assuming%20those%20blank%20columns%20would%20be%20BB3%20%26amp%3B%20BC3%20%26amp%3B%20blank%20and%20again%20give%20you%20what%20you%20want.%20Of%20course%20this%20ONLY%20works%20if%20there%20are%20blank%20columns%20on%20both%20sides.%3CBR%20%2F%3EThere%20are%20other%20tricks%20you%20can%20play%20if%20you%20know%20that%20the%20columns%20of%20interest%20are%20always%20a%20fixed%20amount%20apart%20(e.g.%20columns%2010%2C11%20and%2020%2C21%20and%2030%2C31%20....)%20and%20then%20you%20can%20use%20the%20column%20value%20to%20offset%20the%20cell%20and%20make%20sure%20it%20concatenates%20the%20correct%20set.%20So%20in%20the%20below%20formula%20if%20the%20column%20is%20divisible%20by%2010%20then%20concatenate%20(I%20just%20use%20the%20%26amp%3B%20operator)%20the%20next%20cell%20but%20if%20not%20then%20use%20the%20previous%20cell%3A%3CBR%20%2F%3E%3DVLOOKUP(BB3%26amp%3BOFFSET(BB3%2C0%2CIF(MOD(COLUMN(BB3)%2C10)%2C-1%2C1))%2CLegend!%24G%242%3A%24H%2438%2C2%2CFALSE)%3D%22Blank%22%3CBR%20%2F%3E%3CBR%20%2F%3EAnother%20trick%20could%20be%20to%20use%20the%20column%20header%20to%20do%20the%20offset.%20For%20example%20it%20looks%20like%20the%20column%20header%20of%20the%201st%20column%20in%20each%20pair%20is%20%22W%2FE%22.%20so%20the%20following%20might%20work%3A%3CBR%20%2F%3E%3DVLOOKUP(BB3%26amp%3BOFFSET(BB3%2C0%2CIF(BB%241%3D%22W%2FE%22%2C1%2C-1))%2CLegend!%24G%242%3A%24H%2438%2C2%2CFALSE)%3D%22Blank%22%3CBR%20%2F%3E%3CBR%20%2F%3EI%20hope%20that%20helps%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2475303%22%20slang%3D%22en-US%22%3ERe%3A%20Conditional%20Formatting%20on%20Concatenate%20Formula%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2475303%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F570951%22%20target%3D%22_blank%22%3E%40mtarler%3C%2FA%3E%26nbsp%3BThank%20you%20for%20your%20suggestions%2C%20however%20they%20have%20not%20resolved%20the%20issue.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20formula%20I%20provided%20showed%20cells%20AY%20and%20AZ%2C%20as%20I%20amended%20this%20formula%2C%20however%20they%20originally%20showed%20BB%20and%20BC%20when%20copied%20and%20inserted.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20columns%20either%20side%20will%20not%20be%20blank%2C%20these%20are%20always%20filled%20with%20text%20however%20I%20removed%20this%20as%20they%20contained%20sensitive%20data.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20have%20attached%20sample%20data%20-%20please%20could%20you%20have%20a%20go%20and%20see%20if%20you%20can%20resolve%3F%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThank%20you%20for%20your%20help.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2478771%22%20slang%3D%22en-US%22%3ERe%3A%20Conditional%20Formatting%20on%20Concatenate%20Formula%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2478771%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F972444%22%20target%3D%22_blank%22%3E%40milo1234%3C%2FA%3E%26nbsp%3BI%20created%201%20conditional%20formatting%20formula%20you%20can%20use%20as%20a%20template%3A%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-excel%22%3E%3CCODE%3E%3DVLOOKUP(IFS(LEFT(I%242%2C3)%3D%22W%2FE%22%2CI1%26amp%3BJ1%2CLEFT(H%242%2C3)%3D%22W%2FE%22%2CH1%26amp%3BI1%2C1%2C%22%22)%2CLegend!%24B%242%3A%24C%2438%2C2%2CFALSE)%3D%22AG%22%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3EThis%20was%20applied%20to%20the%20entire%20region%20I%3ABD%20and%20should%20work%20as%20long%20as%20the%20pair%20of%20columns%20you%20want%20it%20applied%20to%20are%20the%20only%20columns%20that%20start%20with%20%22W%2FE%22.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2479857%22%20slang%3D%22en-US%22%3ERe%3A%20Conditional%20Formatting%20on%20Concatenate%20Formula%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2479857%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F570951%22%20target%3D%22_blank%22%3E%40mtarler%3C%2FA%3E%26nbsp%3BThank%20you%20for%20this.%20I%20have%20applied%20the%20formula%20to%20all%20relevant%20columns%20with%20the%20correct%20colour%20coding.%20It%20seems%20to%20work%20for%20most%20of%20the%20cells%2C%20however%20in%20the%20sample%20data%20attached%2C%20if%20I%20change%20a%20cell%20to%20F1%20and%20T1%20this%20should%20be%20green%20together%2C%20however%20one%20cell%20shows%20(F1)%20as%20green%20and%20the%20other%20cell%20as%20red%20(T1).%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAlso%20when%20I%20copy%20the%203%20columns%20and%20insert%20these%20copied%20cells%20for%20a%20new%20week%2C%20the%20cells%20that%20the%20conditional%20formatting%20applies%20to%2C%20changes.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EPlease%20can%20you%20help%3F%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2480459%22%20slang%3D%22en-US%22%3ERe%3A%20Conditional%20Formatting%20on%20Concatenate%20Formula%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2480459%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F972444%22%20target%3D%22_blank%22%3E%40milo1234%3C%2FA%3E%26nbsp%3B%20there%20was%20a%20typo%20in%20one%20of%20the%20formulas%20that%20references%20row%20E%20instead%20of%20H.%26nbsp%3B%20I%20fixed%20that%20so%20I%20hope%20the%20attached%20works%20for%20you.%3C%2FP%3E%3CP%3EAs%20for%20copy%20and%20paste%2C%20yes%20it%20will%20%22change%22%20the%20applied%20to%20and%20the%20formula%20but%20that%20should%20be%20ok.%26nbsp%3B%20What%20it%20is%20doing%20is%20COPYING%20both%20the%20applied%20to%20range%20and%20formula%20and%20shifting%20the%20cell%20references%20according%20to%20the%20new%20location.%26nbsp%3B%20You%20can%20see%20that%20if%20under%20conditional%20formatting%20you%20use%20the%20drop-down%20at%20the%20top%20and%20set%20it%20to%20%22This%20Worksheet%22%20and%20you%20will%20see%20'duplicate%20rules'.%26nbsp%3B%20And%20after%20a%20bit%20of%20copy%2C%20paste%2C%20insert%2C%20and%20such%20that%20conditional%20formatting%20drives%20my%20OCD%20crazy%20and%20I%20have%20to%20'clean%20it%20up'%20but%20that%20is%20cosmetic%20and%20not%20functional%20issues.%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
Contributor

Hi Team, I have successfully created a conditional formatting concatenate formula, however when the columns are copied and new ones are inserted, the conditional formatting cells are using the old columns and not basing them on the new columns.

 

For example: I copy columns AY and AZ into BB and BC, however the formula is picking up AY and AZ still.

 

I have attempted to resolve this issue numerous times, however I have had no luck. Please find print screens attached. 

 

=VLOOKUP(CONCATENATE($BB3,$BC3),Legend!$G$2:$H$38,2,FALSE)="Blank"

=VLOOKUP(CONCATENATE($BB3,$BC3),Legend!$G$2:$H$38,2,FALSE)="R"

=VLOOKUP(CONCATENATE($BB3,$BC3),Legend!$G$2:$H$38,2,FALSE)="AR"

=VLOOKUP(CONCATENATE($BB3,$BC3),Legend!$G$2:$H$38,2,FALSE)="A"

=VLOOKUP(CONCATENATE($BB3,$BC3),Legend!$G$2:$H$38,2,FALSE)="AG"

=VLOOKUP(CONCATENATE($BB3,$BC3),Legend!$G$2:$H$38,2,FALSE)="G"

 

milo1234_0-1624439093585.png

 

milo1234_1-1624439101251.png

 

milo1234_2-1624439107441.png

 

 

8 Replies
Hi, I'm a little confused about the issue. You say, "I copy columns AY and AZ into BB and BC, however the formula is picking up AY and AZ still." but then the formula you give is "=VLOOKUP(CONCATENATE($BB3,$BC3),Legend!$G$2:$H$38,2,FALSE)="Blank""
That said, I think you problem is the $ in the Concatenate formula. On one hand you are using it to force both columns to concatenate the correct cells but then when you copy to new columns it is preventing it from looking at and acting on the new columns.
IF you have blank columns to the left and right of each set as you show above you could make the formula:
=VLOOKUP(CONCATENATE(BA3:BC3),Legend!$G$2:$H$38,2,FALSE)="Blank"

So in this solution cell BB3 would apply the above formula and concatenate BA3:BC3 which would be blank & BB3 & BC3 and give what you want. Then BC3 would concatenate the offset/relative cells BB3:BD3, but again assuming those blank columns would be BB3 & BC3 & blank and again give you what you want. Of course this ONLY works if there are blank columns on both sides.
There are other tricks you can play if you know that the columns of interest are always a fixed amount apart (e.g. columns 10,11 and 20,21 and 30,31 ....) and then you can use the column value to offset the cell and make sure it concatenates the correct set. So in the below formula if the column is divisible by 10 then concatenate (I just use the & operator) the next cell but if not then use the previous cell:
=VLOOKUP(BB3&OFFSET(BB3,0,IF(MOD(COLUMN(BB3),10),-1,1)),Legend!$G$2:$H$38,2,FALSE)="Blank"

Another trick could be to use the column header to do the offset. For example it looks like the column header of the 1st column in each pair is "W/E". so the following might work:
=VLOOKUP(BB3&OFFSET(BB3,0,IF(BB$1="W/E",1,-1)),Legend!$G$2:$H$38,2,FALSE)="Blank"

I hope that helps

@mtarler Thank you for your suggestions, however they have not resolved the issue. 

 

The formula I provided showed cells AY and AZ, as I amended this formula, however they originally showed BB and BC when copied and inserted. 

 

The columns either side will not be blank, these are always filled with text however I removed this as they contained sensitive data. 

 

I have attached sample data - please could you have a go and see if you can resolve? 

 

Thank you for your help. 

 

 

@milo1234 I created 1 conditional formatting formula you can use as a template:

=VLOOKUP(IFS(LEFT(I$2,3)="W/E",I1&J1,LEFT(H$2,3)="W/E",H1&I1,1,""),Legend!$B$2:$C$38,2,FALSE)="AG"

This was applied to the entire region I:BD and should work as long as the pair of columns you want it applied to are the only columns that start with "W/E".

 

@mtarler Thank you for this. I have applied the formula to all relevant columns with the correct colour coding. It seems to work for most of the cells, however in the sample data attached, if I change a cell to F1 and T1 this should be green together, however one cell shows (F1) as green and the other cell as red (T1). 

 

Also when I copy the 3 columns and insert these copied cells for a new week, the cells that the conditional formatting applies to, changes. 

 

Please can you help? 

best response confirmed by milo1234 (Contributor)
Solution

@milo1234  there was a typo in one of the formulas that references row E instead of H.  I fixed that so I hope the attached works for you.

As for copy and paste, yes it will "change" the applied to and the formula but that should be ok.  What it is doing is COPYING both the applied to range and formula and shifting the cell references according to the new location.  You can see that if under conditional formatting you use the drop-down at the top and set it to "This Worksheet" and you will see 'duplicate rules'.  And after a bit of copy, paste, insert, and such that conditional formatting drives my OCD crazy and I have to 'clean it up' but that is cosmetic and not functional issues. 

@mtarler Thank you again, this is really useful. 

I can see you resolved the formula, however when you copy columns BH, BI & BJ for a new week and insert the copied cells, the same issue applies. 

 

T1 and F1 does not change to green together - what can I do to stop this? 

the easiest is to not "insert copied cells", just PASTE. If you need to insert columns then do that 1st then copy and paste. That is interesting what "insert copied cells" does, not sure if that is a bug or not and might be useful trick in certain cases.

@mtarler Thank you so much for helping, I really appreciate it