11.08.2013 Views

Excel's Formula - sisman

Excel's Formula - sisman

Excel's Formula - sisman

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Chapter 20: Creating Megaformulas 563<br />

This technique involves arrays, so you might want to review the material in Part IV to<br />

familiarize yourself with this topic.<br />

This example describes how to create a megaformula that returns the character position of the<br />

last space character in a string. You can, of course, modify the formula to work with any other<br />

character.<br />

Creating the intermediate formulas<br />

The general plan is to create an array of characters in the string but in reverse order. After that<br />

array is created, you can use the MATCH function to locate the first space character in the array.<br />

Refer to Figure 20-4, which shows the results of the intermediate formulas. Cell A1 contains an<br />

arbitrary name, which happens to use 12 characters. The range B1:B12 contains the following array<br />

formula:<br />

{=ROW(INDIRECT(“1:”&LEN(A1)))}<br />

Figure 20-4: These intermediate formulas will eventually be converted to a single megaformula.<br />

This example, named position of last space.xlsx, is available on the companion<br />

CD-ROM.<br />

You enter this multicell array formula into the entire B1:B12 range by selecting the range, typing<br />

the formula, and pressing Ctrl+Shift+Enter. Don’t type the curly brackets. Excel adds the curly<br />

brackets to indicate an array formula. This formula returns an array of 12 consecutive integers.<br />

The range C1:C12 contains the following array formula:<br />

{=LEN(A1)+1–B1:B12}

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!