TECHNOLOGY EXCEL By Orlando Felix-Rodriguez Dynamic Formulas with LEFT and RIGHT Many accountants use Excel as the main be very practical when generating tool to help perform their duties. Be- reports, but it can be difficult when the Creating a Dynamic Formula cause the program is so robust, users information you need, such as a name, Formulas use a diversity of operators aren’t always familiar with all it features isn’t the same number of characters and functions to work with data, and capabilities. Sometimes that leads to each time. That’s because it is a static whether text or values. Combining the use of longer or more complicated function, and pulling a list of names functions enables us to greatly solutions to accomplish a task, such as requires a dynamic function. improve the power of formulas and example is the capacities that Excel pro- The FIND Function tions that are difficult or even impos- vides when different functions are com- In order to help with this scenario, Excel sible if used independently. The FIND bined. Many people use functions has the FIND function. This function function told us where the comma independently and don’t think of com- returns the position of a specified char- appeared in cell A2, and LEFT bining them to maximize their utility. acter or string within a text string. There returned the first nine characters Let’s look at an example using the FIND, are two required arguments. The first from left to right. But the last name LEFT, RIGHT, and LEN functions to split argument indicates the character or text won’t always be nine characters. perform calculations or transforma- when performing data analysis. One the names of employees into separate string you wish to find. The second argu- Since FIND will tell us where the last cells for first name and surname. ment indicates the text or cell you want name ends, we can create a dynamic to search. In our example, a comma is formula by replacing the second The LEFT Function used to separate the first names from argument of the LEFT formula with The LEFT function returns the desired the surnames, so that’s what we’ll look our FIND formula. Because FIND number of characters from a cell start- for. In Figure 2, the formula =FIND(“,”,A2) returns the position of the comma, ing from left to right. The function has shows that the comma in cell A2 is the which we don’t want in our Last two arguments. The first argument is ninth character. (Because FIND can Name column, we have to subtract 1. the cell that contains the data, and the search for a character or a string, if the The final result is =LEFT(A2,FIND second argument is the number of data had a space after the comma, you (“,”,A2)-1). See Figure 3. characters you want from that cell. For could use “, “ as the first argument to example, the formula =LEFT(A2,9) in get the same result.) Note that FIND is Figure 1 returns “Buchanan,” as the only for case-sensitive text compar- The RIGHT and LEN Functions value. isons; wildcard comparisons aren’t Now we need another dynamic supported. formula to get us the first names. This This is an excellent tool that proves to 60 S T R AT E G I C F I N A N C E I September 2012 Figure 1 Figure 2 involves combining the RIGHT and LEN functions with FIND. The RIGHT function works exactly like LEFT, only it goes from right to left. LEN returns the total number of characters in a cell. Use FIND again to tell us the position of the comma in the cell, but we now want the text that comes after it. That means we have to subtract Figure 3 that value from the total number of characters in the cell. The final result, as seen in cell C2 of Figure 4 is =RIGHT(A2,LEN(A2)-FIND(“,”,A2)). These dynamic formulas use simple functions to solve a complicated problem. Even though the length of the names varies from cell to cell, we’re still able to easily separate the first names and surnames. The data is now more flexible and ready to use for more analysis or other uses. In our Figure 4 example, for instance, the data is now better formatted to use for creating form letters or a mail merge. SF Orlando Felix-Rodriguez is an adjunct professor at the University of Phoenix. You can contact him at [email protected]. September 2012 I S T R AT E G I C F I N A N C E 61
© Copyright 2026 Paperzz