Click here to Skip to main content
15,896,153 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How to set multiple conditions for an excel sheet single cell?. I am able to set single conditions of both. I want to check the length of data in excel cell and also space/special validation
Want to show pop up error in excel cell itself on entering the data in the same. I tried as

=if(LEN(Q3)>0,LEN(Q3)=14,SUBSTITUTE(Q3," ","")). When set singly it works. Not working when multiple.
Posted
Comments
Member 10488324 20-Mar-14 0:16am    
=AND(LEN(Q3)=14,SUBSTITUTE(Q3," ","")) also I tried but not working.

SUBSTITUTE(Q3, " ", "")
is not validating the cell, it is changing it.
One way around this (if you must achieve this using Excel datasheet functionality) is to have a "dummy" column hidden away somewhere that does the transformation, then point your validation formula to that cell.

For example Formula for Cell["AL3"] is =SUBSTITUTE(Q3, " ", "") and your validation changes to =if(LEN(AL3)<15,"True_Thing", "False_Thing")

You could have many hidden columns, each performing a specific validation, then your final validation would be (for example)
=AND(AM3, AN3, AO3)


Or do it in VBA where you can apply as many validations as you choose ...e.g. see http://stackoverflow.com/questions/409434/automatically-execute-an-excel-macro-on-a-cell-change[^]
 
Share this answer
 
Comments
Maciej Los 23-Mar-14 12:17pm    
+5!
CHill60 23-Mar-14 12:20pm    
Thank you!
I would suggest to read about: AND[^] and OR[^] functions.

Depending on your needs, your folrmula should looks like:
SQL
=IF(AND(A1<>3,B1=5,C1>9),True, False)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900