Using Countif function for string using a cell reference

Fishless

New Member
Joined
May 2, 2011
Messages
10
First post, hello fellow Excel Geeks

My question is related to the following formula:
=COUNTIF(A1:A1000,"*" & "nav" & "*")

My question: Can this formula be modified so that I can use a cell reference instead of an exact string? Actually, I want to do both. I want to be able to use the cell as the reference that I pull a string from.. Hope that makes sense. That way I can copy the formula easily into many cells. Without modifying it for an exact string.

The reason I need this is because my employees manually enter other employee's name in a column. I then match their entry to my entry. They have a habit of misspelling names, misformatting, and putting spaces where they dont' need to be which is why I want the countif function to match as bestly as it can and ignore some of there mistakes.

Thanks in advance! Again, this is my first post so be easy. ;)
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
Try =COUNTIF(A1:A1000,B1) where B1 is your cell reference to the text string you are looking for.
 
Upvote 0
Thank you both for your quick responses.

B1 has the reference I'm looking and I can get that to work, but what I need to match is.. lets say B1 has the name Rodger Clemings. But what I need the countif function to do is go to B1 and just take perhapes "odger Clem" as the string.

I know this is a stretch but I know somehow it can be done. Is excel smart enough to look at B1 and match 8 out of 15 or so characters? I guess the better question is am I smart enough to make it do that.
 
Upvote 0
Thank you both for your quick responses.

B1 has the reference I'm looking and I can get that to work, but what I need to match is.. lets say B1 has the name Rodger Clemings. But what I need the countif function to do is go to B1 and just take perhapes "odger Clem" as the string.

I know this is a stretch but I know somehow it can be done. Is excel smart enough to look at B1 and match 8 out of 15 or so characters? I guess the better question is am I smart enough to make it do that.

Not sure I understand the query, but here a guess:

=COUNTIF($A$1:$A$1000,RIGHT(B1,8))

where RIGHT takes last 8 chars of the value in B1 and counts literal
occurrences of this in $A$1:$A$1000.
 
Upvote 0
I can't get that one to work. I even changed the numbers of characters all the way down to 3 and still couldn't get it. Weird. Thanks anyway's Aladin.
 
Upvote 0
So what's a valid match in column A if B1 = "Rodger Clemings"?

This formula will count all column A values that are any 8 consecutive characters from B1, e.g. "Rodger C" through to "Clemings" by way of "ger Clem", "r Clemin" etc.

=SUMPRODUCT(ISNUMBER(MATCH(A1:A1000,MID(B1,ROW(INDIRECT("1:"&LEN(B1)-7)),8),0))+0)

it's not case-sensitive
 
Upvote 0
Thank you both for your quick responses.

B1 has the reference I'm looking and I can get that to work, but what I need to match is.. lets say B1 has the name Rodger Clemings. But what I need the countif function to do is go to B1 and just take perhapes "odger Clem" as the string.

I know this is a stretch but I know somehow it can be done. Is excel smart enough to look at B1 and match 8 out of 15 or so characters? I guess the better question is am I smart enough to make it do that.

I can't get that one to work. I even changed the numbers of characters all the way down to 3 and still couldn't get it. Weird. Thanks anyway's Aladin.
If B1 contains Rodger Clemings and you only want to search for odger Clem (which doesn't make any sense to me!)...

=COUNTIF(A1:A100,MID(B1,2,10))

Or, possibly:

=COUNTIF(A1:A100,"*"&MID(B1,2,10)&"*")
 
Upvote 0

Forum statistics

Threads
1,224,602
Messages
6,179,844
Members
452,948
Latest member
UsmanAli786

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