ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Testing the case of text in a cell (https://www.excelbanter.com/excel-worksheet-functions/449971-testing-case-text-cell.html)

Howard Silcock

Testing the case of text in a cell
 
Can anyone suggest a simple way, using formulas, to test whether the text in a cell is all lowercase? I have found one way to do this but it's very complicated and I think there must surely be an easier way.

My first thought was to use the LOWER function (converts text to lowercase) in the formula =(LOWER(A1) = A1) . But this doesn't work, as text comparison seems to be case-insensitive so this always gives TRUE. I didn't want to create a custom function and eventually came up with the ridiculously complex array formula
{=MIN(IFERROR(CODE(MID(A1, {1,2,3,4,5,6,7,8,9,10,11,12,13},1)), 500))=97}
which tests each letter (assuming there are at most 13 letters, which there are in my case) using its ASCII code. (The IFERROR handles cases where there are fewer than 13 letters.) This works if the text consists only of letters.

But can anyone suggest a simpler way?

Howard

joeu2004[_2_]

Testing the case of text in a cell
 
"Howard Silcock" wrote:
Can anyone suggest a simple way, using formulas,
to test whether the text in a cell is all lowercase?


=IF(EXACT(A1,LOWER(A1)),"all lowercase","not all lowercase")


Howard Silcock

Testing the case of text in a cell
 
On Thursday, April 3, 2014 10:05:24 AM UTC+11, joeu2004 wrote:
"Howard Silcock" wrote:

Can anyone suggest a simple way, using formulas,


to test whether the text in a cell is all lowercase?




=IF(EXACT(A1,LOWER(A1)),"all lowercase","not all lowercase")


Thank you very much. I thought there must be a built-in function I could use.

Howard


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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com