Conditional Formatting based on Named Range (List)

zero269

Active Member
Joined
Jan 16, 2023
Messages
253
Office Version
  1. 365
Platform
  1. Windows
Hello,

I'm having some trouble combining two Conditional Formatting rules to work across two columns instead of using them individually.

Currently, I'm using the following to highlight the cells in the Author and Series columns based on a named range (lstPreferred):

Used in Author column (D)
Excel Formula:
=SUM(COUNTIF($A2,"*"&lstPreferred&"*"))
Used in Series column (E)
Excel Formula:
=SUM(COUNTIF($B2,"*"&lstPreferred&"*"))

NOTE: I just discovered while drawing up this post that the xl2bb Add-in is not working right now. I'll need to troubleshoot this later...

In the meantime, here's my Sample Sheet that I'm using to TRY and combine the two to work independently... if possible:

1676488840076.png


I tried using the following in the Combined (test) column F to no avail:
Excel Formula:
=SUM(COUNTIFS($A2,"*"&lstPreferred&"*",$B2,"*"&lstPreferred&"*"))
I've tried playing around with the OR function but had undesired results as I couldn't figure it out.

Any help with on this would be greatly appreciated.

Thank you,
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
Try select both columns & then use
Excel Formula:
=SUM(COUNTIF(A2,"*"&lstPreferred&"*"))
 
Upvote 1
Solution
Try select both columns & then use
Excel Formula:
=SUM(COUNTIF(A2,"*"&lstPreferred&"*"))
Amazing Fluff!

Worked perfectly!

I can't believe I didn't think of removing the absolute column reference. It never crossed my mind.

Thanks for your help with this:

I got my XL2BB add-in working again, so here are the results:

VBA Testing.xlsm
AB
1AuthorSeries
2Dr. SeussBerenstain Bears
3Larrison, Joanne
4Lucado, Max
5Mayer, MercerCorduroy
6Rey, MargretZonderkidz
7Sendak, MauriceDr. Seuss
8Willems, Mo
CF List
Cells with Conditional Formatting
CellConditionCell FormatStop If True
A2:B8Expression=SUM(COUNTIF(A2,"*"&lstPreferred&"*"))textNO

Applies to: =$A$2:$B$8 is how the Conditional Formatting Rules Manager displays
 
Upvote 0

Forum statistics

Threads
1,223,884
Messages
6,175,175
Members
452,615
Latest member
bogeys2birdies

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