Count If Issue

russelgreen

New Member
Joined
Nov 21, 2012
Messages
18
Office Version
  1. 365
Platform
  1. Windows
Hi all,

I'm trying to create an spreadsheet which counts certain words in a cell only once and gives me a total. I can do this but some of the words I'm searching for are part of another word that I'm searching (eg room and room service).

So this spreadsheet will look at company reviews and count how many times the key words are mentioned. How can search for one and it doesn't count as part of the other search?

Regards,

Russ
 

russelgreen

New Member
Joined
Nov 21, 2012
Messages
18
Office Version
  1. 365
Platform
  1. Windows
Firstly, you are not using the forum quote tags correctly. I fixed post 15 and 19 for you but quotes are for posting what has appeared in another post, not what you are currently writing. Post 19 looked like below before I edited it. It says "Peter_SSs said: ..." but in fact it is what you were saying, not me. ;)

View attachment 26006

The #NAME? error has two likely causes.
- You have not used the same spelling of the function name on the worksheet as it is in the code, or
- You have placed the code in the wrong place in the vba window.

So check both spellings carefully and review steps 1 to 3 in my instructions above.

Thanks for updating your profile. (y)
Thanks Peter, and sorry for the posting error...
So I've tried again and still nothing? Where would i find the function name to make sure it is the same as the code?
I believe that I placed the code in the correct place, but still nothing....
Sorry for being so thick...
 

Some videos you may like

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.

Peter_SSs

MrExcel MVP, Moderator
Joined
May 28, 2005
Messages
46,825
Office Version
  1. 365
Platform
  1. Windows
Sorry for being so thick...
No need to apologise when you are just getting started. :)

Placing the code: In the vba window (you can open it with Alt+F11 if it is not already open) find your project in the project explorer at the left and open out all the sections by clicking any + signs.
Mine is called russelgreen.xlsm and looks like below. If you have a Module 1 and double-click that do you see the code on the right like below?

1605269418078.png



To check spelling. The two highlighted items below (one in the vba window, one in the worksheet formula) should be the same

1605269522654.png


1605269556911.png
 

russelgreen

New Member
Joined
Nov 21, 2012
Messages
18
Office Version
  1. 365
Platform
  1. Windows
No need to apologise when you are just getting started. :)

Placing the code: In the vba window (you can open it with Alt+F11 if it is not already open) find your project in the project explorer at the left and open out all the sections by clicking any + signs.
Mine is called russelgreen.xlsm and looks like below. If you have a Module 1 and double-click that do you see the code on the right like below?

View attachment 26007


To check spelling. The two highlighted items below (one in the vba window, one in the worksheet formula) should be the same

View attachment 26009

View attachment 26010
Thanks Peter,

Yes i see the code under Module 1 in the VBA project. The only thing I noticed that was different was you have something called Option Explicit at the top of your code and I don't? Spelling is the same on both...
 

Peter_SSs

MrExcel MVP, Moderator
Joined
May 28, 2005
Messages
46,825
Office Version
  1. 365
Platform
  1. Windows
different was you have something called Option Explicit at the top of your code and I don't
That is not important in relation to this error. Is it possible that you could upload a sample workbook (with any sensitive data removed or disguised) with a small set of sample data and the formula entered into column D to say DropBox, OneDrive, Google Drive, etc and provide a shared link here?
 

russelgreen

New Member
Joined
Nov 21, 2012
Messages
18
Office Version
  1. 365
Platform
  1. Windows
That is not important in relation to this error. Is it possible that you could upload a sample workbook (with any sensitive data removed or disguised) with a small set of sample data and the formula entered into column D to say DropBox, OneDrive, Google Drive, etc and provide a shared link here?
Thanks Peter,

move saved the item again and deleted and re I put the vba and it works a treat. Thank you so much for your help and time.

stay safe
 
Solution

Peter_SSs

MrExcel MVP, Moderator
Joined
May 28, 2005
Messages
46,825
Office Version
  1. 365
Platform
  1. Windows
You're welcome. Glad you got it sorted. (y)
 

Watch MrExcel Video

Forum statistics

Threads
1,113,890
Messages
5,544,888
Members
410,643
Latest member
sng
Top