Hello,
I have a column in which every cell contains a different number of words. Is it possible to filter only these cells that contain one or two words?
Thanks!
Hello,
I have a column in which every cell contains a different number of words. Is it possible to filter only these cells that contain one or two words?
Thanks!
Last edited by emil9216; 01-24-2012 at 06:25 PM.
Hi Emil
One way is this.
Let's say that your words are in column A, starting in A1.
So in B1, use this formula.
=LEN(TRIM(A1))-LEN(SUBSTITUTE(A1;" ";""))+1
This will show you, how many words are in A1. Copy down.
Then use Auto filter by column B, to get your result.
Hope to helps you.
Regards
Fotis.
-This is my Greek whisper to Europe.
--Remember, saying thanks only takes a second or two. Click the little star * below, to give some Rep if you think an answer deserves it.
Advanced Excel Techniques: http://excelxor.com/
--KISS(Keep it simple Stupid)
--Bring them back.
---See about Acropolis of Athens.
--Visit Greece.
Hi emil9216,
How about a User Defined Function (UDF) to count words in a cell. This is really the number of spaces plus 1.
Please Login or Register to view this content.
One test is worth a thousand opinions.
Click the * Add Reputation below to say thanks.
@Fotis1991
I tried the formula but it doesn't seem to work. If i paste the formula in B1 nothing happening.
@MarvinP
Thanks, but i am not sure how to use the User Defined Function. Is it something like creating macro: from the Visual Basic button, Insert>Module and paste the code in the window. Because i tried this but it doesn't work.
Hi Emil
Pls take a look to the sample.
Hope to be OK, now.
Thanks, now it is working but i think the formula in your post didn't work because it has semicolons instead of commas in it.
You are welcome
In my Excel addition, i have to use semicolons instead of commas, if i want my formulas to be ok!
So, if you found your solution, mark your Thread, as SOLVED.
Here is my UDF workbook attached for your examination.
Also for those who like the TRIM function, it looks like the VBA Trim() doesn't do the same thing as:
Application.WorksheetFunction.Trim().
It looks like the VBA Trim() does NOT collapse double spaces to single spaces when not at the front or rear of the string. Who would have known, without a test?? This makes my above code different than the code inside the attached.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks