# Excel: A Simple Formula for “If Length Greater Than”

You can use the following formula in Excel to check if the string in a particular cell is greater than a certain length:

```=IF(LEN(A2)>4,"Greater than 4","Not Greater than 4")
```

This particular formula checks if the length of the string in cell A2 is greater than 4 and returns “Greater than 4” if so.

Otherwise the formula returns “Not Greater than 4.”

The following example shows how to use this formula in practice.

## Example: Check if Cell Contains String with Length Greater than Certain Value

Suppose we have the following column of strings in Excel with information about various basketball teams:

We can use the following formula to check if the length of each string in the Team column is greater than 4:

`=IF(LEN(A2)>4,"Greater than 4","Not Greater than 4")`

We’ll type this formula into cell B2 and then click and drag it down to each remaining cell in column B:

Each cell in column B returns a string that tells us if the corresponding string in column A has a length greater than 4 or not.

Also note that we could return values other than strings if we’d like.

For example, we can use the following formula to only return the first 4 characters in a string if the length of the string is greater than 4 or return “FALSE” otherwise:

`=IF(LEN(A2)>4,LEFT(A2, 4),"FALSE")`

We’ll type this formula into cell B2 and then click and drag it down to each remaining cell in column B:

If the length of the string in column A is greater than 4, then only the first 4 characters of the string are returned in column B.

Otherwise, if the length of the string in column A is not greater than 4 then we simply return FALSE in column B.