Formula to count the characters in a cell, but exclude certain characters (plural)

Thistles

New Member
Joined
Aug 30, 2017
Messages
2
I'm learning as I go with Excel, and can't get my head around how to write this formula (if it is even possible).

I want to count the characters in a cell, but exclude certain characters (plural). E.g. coding and spaces. I know how to count the characters and exclude only spaces:

=LEN(SUBSTITUTE(A2," ",""))

I want to add to this formula so that it counts the characters in a cell, excluding not just spaces but other characters. For the purposes of this example, let's say I want to exclude both the letters x and y from the character count.

I tried various iterations, all of which threw up errors, then this one didn't but it doesn't work (gives me the wrong count):

=LEN(SUBSTITUTE(A2,"x",""))&LEN(SUBSTITUTE(A2,"y",""))

Is there a way to do it?

Thanks
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.

Forum statistics

Threads
1,214,897
Messages
6,122,151
Members
449,068
Latest member
shiz11713

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