Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 312
Default Dataval question

I use the below formula in datavalidation to not allow commas in the cell.
Is there a way to add to this to also not allow more than 1 blank space in
the cell? Thank you!!

=IF(ISERROR(FIND(",",B5)),1,0)


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Dataval question

Use a validation formula like

=(LEN(B5)-LEN(SUBSTITUTE(B5," ","")))<2

Note that there is one space between the first set of quote
marks, and nothing between the second set of quote marks.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"Steph" wrote in message
...
I use the below formula in datavalidation to not allow commas
in the cell.
Is there a way to add to this to also not allow more than 1
blank space in
the cell? Thank you!!

=IF(ISERROR(FIND(",",B5)),1,0)




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 312
Default Dataval question

Hi Chip. Thanks for the formula. One folluw up question - Can we combine
the two formulas into one, so as to not allow commas OR more than one space
in the cell?

So essentially, combine:
=(LEN(B5)-LEN(SUBSTITUTE(B5," ","")))<2 and
=IF(ISERROR(FIND(",",B5)),1,0)

Thanks!!


"Chip Pearson" wrote in message
...
Use a validation formula like

=(LEN(B5)-LEN(SUBSTITUTE(B5," ","")))<2

Note that there is one space between the first set of quote
marks, and nothing between the second set of quote marks.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"Steph" wrote in message
...
I use the below formula in datavalidation to not allow commas
in the cell.
Is there a way to add to this to also not allow more than 1
blank space in
the cell? Thank you!!

=IF(ISERROR(FIND(",",B5)),1,0)






  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 690
Default Dataval question

I think this should work for you.
=AND((LEN(B5)-LEN(SUBSTITUTE(B5," ","")))<2,ISERROR(FIND(",",B5)))

Note that you do not need IF( ) with ISERROR because that function returns
True/False anyway.
HTH.
--
Dana DeLouis
Win XP & Office 2003


"Steph" wrote in message
...
Hi Chip. Thanks for the formula. One folluw up question - Can we combine
the two formulas into one, so as to not allow commas OR more than one
space
in the cell?

So essentially, combine:
=(LEN(B5)-LEN(SUBSTITUTE(B5," ","")))<2 and
=IF(ISERROR(FIND(",",B5)),1,0)

Thanks!!


"Chip Pearson" wrote in message
...
Use a validation formula like

=(LEN(B5)-LEN(SUBSTITUTE(B5," ","")))<2

Note that there is one space between the first set of quote
marks, and nothing between the second set of quote marks.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"Steph" wrote in message
...
I use the below formula in datavalidation to not allow commas
in the cell.
Is there a way to add to this to also not allow more than 1
blank space in
the cell? Thank you!!

=IF(ISERROR(FIND(",",B5)),1,0)








  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 312
Default Dataval question

Perfect. Thank you!

"Dana DeLouis" wrote in message
...
I think this should work for you.
=AND((LEN(B5)-LEN(SUBSTITUTE(B5," ","")))<2,ISERROR(FIND(",",B5)))

Note that you do not need IF( ) with ISERROR because that function returns
True/False anyway.
HTH.
--
Dana DeLouis
Win XP & Office 2003


"Steph" wrote in message
...
Hi Chip. Thanks for the formula. One folluw up question - Can we

combine
the two formulas into one, so as to not allow commas OR more than one
space
in the cell?

So essentially, combine:
=(LEN(B5)-LEN(SUBSTITUTE(B5," ","")))<2 and
=IF(ISERROR(FIND(",",B5)),1,0)

Thanks!!


"Chip Pearson" wrote in message
...
Use a validation formula like

=(LEN(B5)-LEN(SUBSTITUTE(B5," ","")))<2

Note that there is one space between the first set of quote
marks, and nothing between the second set of quote marks.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"Steph" wrote in message
...
I use the below formula in datavalidation to not allow commas
in the cell.
Is there a way to add to this to also not allow more than 1
blank space in
the cell? Thank you!!

=IF(ISERROR(FIND(",",B5)),1,0)










Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Question on looking up data Nick H[_2_] Excel Worksheet Functions 2 June 5th 09 03:34 PM
Data Table Question? Bob Excel Discussion (Misc queries) 2 June 3rd 09 02:09 AM
Data Filtering question. KUKA Guy Excel Worksheet Functions 9 March 9th 07 11:33 AM
VBA Question / Clearing out All Data carl Excel Worksheet Functions 3 March 2nd 05 07:57 PM
Data Validation Question Kenny Excel Programming 2 November 11th 03 05:28 AM


All times are GMT +1. The time now is 08:03 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"