2 Replies Latest reply on Nov 3, 2008 8:53 AM by davidphillips

    Count number of characters in a field

    davidphillips

      Title

      Count number of characters in a field

      Post

      I have a file with over 3,000 records. Each record has an Item Number field. I need to find all records with Item Number field having more than 15 characters. Is there an easy way to count the characters in this field?

        • 1. Re: Count number of characters in a field
          Orlando
            

          Hi davidphilips

           

          This can be done quite easily. Assuming you have no spaces or carriage returns then you can simply use  the 'Length' function. This will count the number of characters, including spaces and carriage returns, in a field.

           

          If you want to see the number of characters in the field simply create a calculated field with the following:

           

          Length ( Field )

           

          And perform a search of "> 15" on the calculated field.

           

          However if you want to have the calculation to be boolean if the field had more than 15 characters then modifiy it slightly to the following

           

          Length ( Field ) > 15 

           

          And this will return a 1 in the field if the length is greater than 15. 

            

          Finally if you do have any characters like spaces and carriage returns in the field you do not want to count, you will need to remove these using the Substitute function

           

          Length ( Substitute ( Field ; [ " " ; "" ];[ "¶" ; "" ] )

           

          I hope I have not overcomplicated this for you.

           

          • 2. Re: Count number of characters in a field
            davidphillips
              

            Hi Orlando, 

            Many, many thanks - this worked like a charm!