11.08.2013 Views

Excel's Formula - sisman

Excel's Formula - sisman

Excel's Formula - sisman

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

134<br />

Part II: Using Functions in Your <strong>Formula</strong>s<br />

Finding and searching within a string<br />

The Excel FIND and SEARCH functions enable you to locate the starting position of a particular<br />

substring within a string:<br />

FIND: Finds a substring within another text string and returns the starting position of the<br />

substring. You can specify the character position at which to begin searching. Use this<br />

function for case-sensitive text comparisons. Wildcard comparisons are not supported.<br />

SEARCH: Finds a substring within another text string and returns the starting position of<br />

the substring. You can specify the character position at which to begin searching. Use<br />

this function for non–case-sensitive text or when you need to use wildcard characters.<br />

The following formula uses the FIND function and returns 7, the position of the first m in the<br />

string. Notice that this formula is case sensitive.<br />

=FIND(“m”,”Big Mamma Thornton”,1)<br />

The formula that follows, which uses the SEARCH function, returns 5, the position of the first m<br />

(either uppercase or lowercase):<br />

=SEARCH(“m”,”Big Mamma Thornton”,1)<br />

You can use the following wildcard characters within the first argument for the SEARCH function:<br />

Question mark (?): Matches any single character<br />

Asterisk (*): Matches any sequence of characters<br />

If you want to find an actual question mark or asterisk character, type a tilde (~) before<br />

the question mark or asterisk.<br />

The next formula examines the text in cell A1 and returns the position of the first three-character<br />

sequence that has a hyphen in the middle of it. In other words, it looks for any character followed<br />

by a hyphen and any other character. If cell A1 contains the text Part-A90, the formula returns 4.<br />

=SEARCH(“?-?”,A1,1)<br />

Searching and replacing within a string<br />

You can use the REPLACE function in conjunction with the SEARCH function to create a new<br />

string that replaces part of the original text string with another string. In effect, you use the<br />

SEARCH function to find the starting location used by the REPLACE function.

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

Saved successfully!

Ooh no, something went wrong!