You are here:

# Excel/match index bring back filled cells only

Question
Tom,
Hello sir, hope you can help. I have the following formula in excel and it works except for one small detail. I only want it to bring back information if the cell has a name. Currently the cells come back with a name or blank if cell is 0. I would like it to only bring back if cell has a name. the formula is an array.
{=IF(SMALL(IF(\$P\$5:\$P\$12>1,IF(LEN(\$C\$5:\$C\$12)>0,ROW(\$P\$5:\$P\$12),9999),9999),ROW()-2)=9999,"",INDEX(C:C,SMALL(IF(\$P\$5:\$P\$12>1,IF(LEN(\$C\$5:\$C\$12)>0,ROW(\$P\$5:\$P\$12),9999),9999),ROW()-2),1))}. This currently brings back names and blanks. If I have a blank cell in the middle or anywhere else as far as that goes I want to skip and continue getting names only.
Thank you for looking.
John

John,

=INDEX(\$C:\$C,SMALL(IF((\$P\$5:\$P\$12>1)*(LEN(\$C\$5:\$C\$12)>0),ROW(\$P\$5:\$P\$12)),ROW(\$A1)),1)
enter as an array formula
then drag fill down until you start getting errors.

If you are using Excel 2007 or later you can use

=IFERROR(INDEX(C:C,SMALL(IF((\$P\$5:\$P\$12>1)*(LEN(\$C\$5:\$C\$12)>0),ROW(\$P\$5:\$P\$12)),ROW(\$A1)),1),"")
Also array entered.  Then drag fill down the column

The row(A1) produces a 1 as the second argument to SMALL.  I assume your formula is entered in row 3 and row()-2 produces a 1 but using row(\$A1) makes this work regardless of what cell you start in.

That worked for me as I understand the requirement.

--
Regards,
Tom Ogilvy

Questioner's Rating
 Rating(1-10) Knowledgeability = 10 Clarity of Response = 10 Politeness = 10 Comment Very fast response and a perfect answer for what has been a very difficult question to get answered. Thank you your help and it is greatly appreciated.

This topic answers questions related to Microsoft Excel spreadsheet (or workbook) stand-alone or Mircrosoft Office Excel including Excel 2003, Excel 2007, Office 2000, and Office XP. You can get Excel help on Excel formulas(or functions), Excell macros, charting in Excel, advanced features, and the general use of Excel. This does not provide a general Excel tutorial nor the basics of using a spreadsheet. It provides specific answers to using Microsoft Excel only. If you do not see your Excel question answered in this area then please ask an Excel question here

#### Tom Ogilvy

##### Expertise

Selected as an Excel MVP by Microsoft since 1999. Answering Excel questions in Allexperts since its inception in 2001. Able to answer questions on almost all aspects of Excel's internal capabilities. If seeking a VBA solution, please specify that in your question itself so I give you the answer you want. [Excel has weak protection - if you are distributing an application, I don't answer questions on how to protect your project from your users.]

##### Experience

Extensive experience.

Education/Credentials
Master of Science (MS) degree Operations Research (ORSA)

Awards and Honors
Microsoft MVP in Excel.