MrExcel Publishing
Your One Stop for Excel Tips & Solutions

testing cell text


Posted by roger on January 30, 2002 6:03 AM

is there a way test just the first three characters of a cell?
thanks,
Roger


Posted by Aladin Akyurek on January 30, 2002 6:10 AM

Care to tell what kind of test you want to do, using an example if possible?

Posted by Roger on January 30, 2002 6:19 AM

Can do. I have multiple tables of data where I need to weed out any rows where the first three letters of a string are not "SST". What I need to know is whether to use activecell.value or activecell.text and how to select only the first three characters of any given string.
Thanks,
Roger

Posted by Aladin Akyurek on January 30, 2002 6:53 AM

Attn. VBA folks: It seems Roger Needs VBA. [NT]

Posted by Juan Pablo G. on January 30, 2002 7:36 AM

ActiveCell.Value and ActiveCell.Text operates *MOST* of the time the same. The difference is that Value returns the stored value and Text returns the formatted value. For example, if A1 has

5.65%

Then .Value will be 0.0565, and .Text will be "5.65%"

You can test the string using same functions as in Excel, that is

My3char = Left(MyString,3)

Juan Pablo G.