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.

398<br />

Part IV: Array <strong>Formula</strong>s<br />

The IF function creates a new array that consists of the row number of values from the Data<br />

range that are equal to Value. Values from the Data range that aren’t equal to Value are replaced<br />

with an empty string. The SMALL function works on this new array and returns the nth smallest<br />

row number.<br />

The formula returns #NUM! if the value is not found or if n exceeds the number of occurrences of<br />

the value in the range.<br />

Returning the longest text in a range<br />

The following array formula displays the text string in a range (named Data) that has the most<br />

characters. If multiple cells contain the longest text string, the first cell is returned.<br />

{=INDEX(Data,MATCH(MAX(LEN(Data)),LEN(Data),FALSE),1)}<br />

This formula works with two arrays, both of which contain the length of each item in the Data<br />

range. The MAX function determines the largest value, which corresponds to the longest text<br />

item. The MATCH function calculates the offset of the cell that contains the maximum length. The<br />

INDEX function returns the contents of the cell containing the most characters. This function<br />

works only if the Data range consists of a single column.<br />

Determining whether a range contains valid values<br />

You may have a list of items that you need to check against another list. For example, you may<br />

import a list of part numbers into a range named MyList, and you want to ensure that all the part<br />

numbers are valid. You can do so by comparing the items in the imported list to the items in a<br />

master list of part numbers (named Master).<br />

The following array formula returns TRUE if every item in the range named MyList is found in the<br />

range named Master. Both ranges must consist of a single column, but they don’t need to contain<br />

the same number of rows.<br />

{=ISNA(MATCH(TRUE,ISNA(MATCH(MyList,Master,0)),0))}<br />

The array formula that follows returns the number of invalid items. In other words, it returns the<br />

number of items in MyList that do not appear in Master.<br />

{=SUM(1*ISNA(MATCH(MyList,Master,0)))}<br />

To return the first invalid item in MyList, use the following array formula:<br />

{=INDEX(MyList,MATCH(TRUE,ISNA(MATCH(MyList,Master,0)),0))}

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

Saved successfully!

Ooh no, something went wrong!