Word count in a cell using variable and returning error if exceeded

JamboBob

New Member
Joined
Oct 16, 2020
Messages
19
Office Version
  1. 365
  2. 2010
Platform
  1. Windows
  2. Mobile
  3. Web
Hi,

I am putting together a spreadsheet for procurement purposes where the user has to limit their answer to a specified number of words (variable per question) in a cell. How can I:
1. Set the variable;
2. Count the words entered;
3. Return a word count or error message if exceeded?

I would also like to have the number of words allowed showing in the answer cell that gets deleted as they start typing but can reappear if they delete the entry, is this possible?

Any help would be greatly appreciated, thanks.
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
Hi there mate,
The easiest way i can think of to do this without having to code is to head to data validation in the data ribbon, in the dropdown menu choose texte length, once you do get 2 boxes in which you input the minimum and maximun text length allowed for the selected range pop up.
You have the option in last tab of the data validation window to input a text that users see whenever they exceed the max count.

Hope this helps
 
Upvote 0
Hi there mate,
The easiest way i can think of to do this without having to code is to head to data validation in the data ribbon, in the dropdown menu choose texte length, once you do get 2 boxes in which you input the minimum and maximun text length allowed for the selected range pop up.
You have the option in last tab of the data validation window to input a text that users see whenever they exceed the max count.

Hope this helps
Hi,

My understanding is that this counts characters, not words. As this is a procurement document I need words. Happy to do some coding but just need some guidance.

Thanks
 
Upvote 0
You can do it with Data validation.
In the DV select Custom & use
Excel Formula:
=LEN(D2)-LEN(SUBSTITUTE(D2," ",""))<C2
where D2 is the cell with the DV & C2 is the max number of words.
 
Upvote 0
Solution
You can do it with Data validation.
In the DV select Custom & use
Excel Formula:
=LEN(D2)-LEN(SUBSTITUTE(D2," ",""))<C2
where D2 is the cell with the DV & C2 is the max number of words.
Hi,

Thanks for this. How would I pass the number of characters allowed to this or do I set it up for each cell? My preference would be to have a function that looked at the number of characters allowed then did this check using this number (does that make sense?).

Thanks
 
Upvote 0
I thought you wanted the number of words, not characters?
 
Upvote 0
I thought you wanted the number of words, not characters?
I do want the number of words.

I have a spreadsheet with a set of questions. Each question has an answer whose word count will vary (e.g., Q1 500 words, Q2 250 words, etc). I need to check the number of words is the answer does not exceed the allowable number. If I can use a function to make this repeatable that is my preferred option.
 
Upvote 0
I do want the number of words.

I have a spreadsheet with a set of questions. Each question has an answer whose word count will vary (e.g., Q1 500 words, Q2 250 words, etc). I need to check the number of words is the answer does not exceed the allowable number. If I can use a function to make this repeatable that is my preferred option.
Example rows:
1604936310675.png
 
Upvote 0
If you just want to use a function then you can use the formula I suggested in post#4, just change the cell refs to suit.
 
Upvote 0

Forum statistics

Threads
1,214,815
Messages
6,121,715
Members
449,049
Latest member
THMarana

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