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.

564<br />

Part V: Miscellaneous <strong>Formula</strong> Techniques<br />

This formula essentially reverses the integers generated in column B.<br />

The range D1:D12 contains the following array formula:<br />

{=MID(A1,C1:C12,1)}<br />

This formula uses the MID function to extract the individual characters in cell A1. The MID function<br />

uses the array in C1:C12 as its second argument. The result is an array of the name’s characters in<br />

reverse order.<br />

The formula in cell E1 is as follows:<br />

=MATCH(“ “,D1:D12,0)<br />

This formula, which is not an array formula, uses the MATCH function to return the position of the<br />

first space character in the range D1:D12. In the example shown in Figure 20-4, the formula<br />

returns 6, which means that the first space character is six characters from the end of the text in<br />

cell A1.<br />

The formula in cell F1 is<br />

=LEN(A1)+1–E1<br />

This formula returns the character position of the last space in the string.<br />

You may wonder how all of these formulas can possibly be combined into a single formula. Keep<br />

reading for the answer.<br />

Creating the megaformula<br />

At this point, cell F1 contains the result that you’re looking for — the number that indicates the<br />

position of the last space character. The challenge is consolidating all of those intermediate formulas<br />

into a single formula. The goal is to produce a formula that contains only references to cell<br />

A1. These steps will get you to that goal:<br />

1. The formula in cell F1 contains a reference to cell E1. Replace that reference with the text<br />

of the formula in cell E1.<br />

As a result, the formula in cell F1 becomes<br />

=LEN(A1)+1–MATCH(“ “,D1:D12,0)<br />

2. The formula contains a reference to D1:D12. This range contains a single array formula.<br />

Replacing the reference to D1:D12 with the array formula results in the following array formula<br />

in cell F1:<br />

{=LEN(A1)+1–MATCH(“ “,MID(A1,C1:C12,1),0)}

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

Saved successfully!

Ooh no, something went wrong!