COUNTIF ignore wildcards

mona92

New Member
Joined
May 10, 2021
Messages
5
Office Version
  1. 365
Platform
  1. Windows
I have nearly the same problem like in this thread and tried its solution:

I have two Sheets. On the first sheet ("Query" )I have a column where I want to format a word if this word exists anywhere on the second sheet ("Synonyme").
My formula looks like:
File-Copy-icon.png

=COUNTIF(Synonyme!A1:AM146;SUBSTITUTE(B2,"*","~*"))>0

I get an error:

Formula or value in conditional formatting is invalid

This works but uses wildcards (what I don't want):

=COUNTIF(Synonyme!A1:AM146;B2)>0
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
Welcome to MrExcel Message Board.
Are you try with Comma Not SemiColon at formula?
 
Upvote 0
Are you have conditional formatting or data validation at that range or formula Cell?
 
Upvote 0
It appears you use semicolons as separators, so you need those in the SUBSTITUTE part too:

Excel Formula:
=COUNTIF(Synonyme!A1:AM146;SUBSTITUTE(B2;"*";"~*"))>0
 
Upvote 0
Solution
I use conditional formatting and then the option "Use a formula to determine which cells to format". Is this what you asked for?
 
Upvote 0
It appears you use semicolons as separators, so you need those in the SUBSTITUTE part too:

Excel Formula:
=COUNTIF(Synonyme!A1:AM146;SUBSTITUTE(B2;"*";"~*"))>0
Aaaah thank you so much!
 
Upvote 0
But I still have something wrong. I need to check each row of column B. So I have to change the value in substitute of B2 to $B$2 or something like this?
 
Upvote 0
No, but you should make the first range absolute since you don't want that to change for each row:

Excel Formula:
=COUNTIF(Synonyme!$A$1:$AM$146;SUBSTITUTE(B2;"*";"~*"))>0
 
Upvote 0

Forum statistics

Threads
1,215,646
Messages
6,126,000
Members
449,279
Latest member
Faraz5023

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