View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Howard Silcock Howard Silcock is offline
external usenet poster
 
Posts: 16
Default 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