LEFT / Coding Instructor

Identify Variable Type

I need to check if the variable name starts with 'str' to identify it as a string.

formula.xlsx
=LEFT(A2, 3)="str"

How it works: The `LEFT` function extracts a specified number of characters from the beginning of a text string. In this scenario, `LEFT(A2, 3)` extracts the first three characters from the variable name in cell A2. We then compare this extracted substring to the literal string "str" using the equality operator (`=`). If they match, the formula returns `TRUE`, indicating a string variable. Otherwise, it returns `FALSE`. This provides a quick boolean check for variable type identification.

Data Setup

VariableName Description
strUserName User's full name
intAge User's age
strAddress User's physical address
boolIsActive User's active status
strCity City of residence

Step-by-Step Guide

1

Assume your variable names are listed in column A, starting from cell A2.

2

In cell B2, enter the formula: `=LEFT(A2, 3)="str"`.

3

Press Enter. Cell B2 will now display `TRUE` if the variable name in A2 starts with 'str', and `FALSE` otherwise.

4

Drag the fill handle (the small square at the bottom-right of cell B2) down to apply the formula to the rest of your variable names in column A.