Return Non Blank Cells from a Range in Excel (3 Suitable Ways)

The following dataset consists of two columns labeled Area and Sales Rep. It has several records that are missing important information. We are going to utilize each of the three methods to return the cells that have data from a range, and then we are going to collect that data in a new column that is going to be called Sales Rep List.

excel return non blank cells from a range

Method 1 – Utilize the FILTER Function to Display Non-Blank Cells from a Field in Excel


  • Create another column D titled Sales Rep List.
  • Select the D5 cell.
  • Copy the following formula in the Formula Bar.

=FILTER($C$5:$C$10,$C$5:$C$10 <> "")

  • Hit the Enter or Tab key.

Utilize FILTER Function to Display Non Blank Cells from a Field in Excel

Method 2 – Combine IFERROR, INDEX, SMALL, and ROW Functions to Get Non-Empty Cells from a Range


  • Make another column D called Sales Rep List.
  • Choose the D5 cell.
  • Copy the following formula in the cell.


  • Hit Enter or Tab.

Combine IFERROR, INDEX, SMALL, and ROW Functions to Get Non-Empty Cells From a Range

  • We will get the intended outcome for D5.
  • Use the AutoFill Handle icon and drag it into cell D10.

Output of Combining IFERROR, INDEX, SMALL, and ROW Functions to Get Non-Empty Cells From a Range

How Does the Formula Work?


For this formula to make sense, you need to know how to use the following Excel functions:

IFERROR, INDEX, SMALL, ROW and Rows Functions

  • ROW($C$5:$C$10)-ROW($C$5)+1)

The ROW function within Excel provides the cell’s row number. By involving the Row function in the combination, we find- {1;2;3;4;5;6}.

  • IF($C$5:$C$10<>””,ROW($C$5:$C$10)-ROW($C$5)+1)

The IF function compares any value in the range $C$5:$C$10 and the null value. Utilizing the IF function, we get – {1;2;FALSE;4;FALSE;6}

  • ROWS($C$5:$C5))

The ROWS function will retrieve the total number of rows included when passing an Excel range. In this demo, it will produce 1 for the first row.

  • SMALL(IF($C$5:$C$10<>””,ROW($C$5:$C$10)-ROW($C$5)+1),ROWS($C$5:$C5))

The SMALL function provides ranked numerical values according to their location in a given list. It finds the k-smallest item in a particular dataset and delivers the deals. The SMALL function produces 1 as an outcome for the first row.

  • INDEX($C$5:$C$10,SMALL(IF($C$5:$C$10<>””,ROW($C$5:$C$10)-ROW($C$5)+1),ROWS($C$5:$C5)))

To get data from a specific location in a column or range, use the INDEX function. Olivia will appear at the top of the list in this case.

  • IFERROR(INDEX($C$5:$C$10,SMALL(IF($C$5:$C$10<>””,ROW($C$5:$C$10)-ROW($C$5)+1),ROWS($C$5:$C5))),””)

The ISERROR is a function that tells whether the cells or formulas contain calculation mistakes. We will get Errors when we try to work with empty cells, and we will use the ISERROR function to avoid these errors.

Method 3 – Run Excel VBA Code to Return Non-Blank Cells from a Range


  • Choose the intended sheet as the Active sheet.
  • Create another column D.
  • Navigate to the Developer tab and click the Visual Basic icon.

Run Excel VBA Code to Return Non Blank Cells From a Range

  • Click on Insert and Module

  • Input the following code in the Module box.
Sub ReturnNonBlankCells()
    ActiveCell.Formula2R1C1 = "=FILTER(R5C3:R10C3," & Chr(10) & "R5C3:R10C3 <> """")"
End Sub
  • Press F5 or the Save button.

  • This will provide the desired result like the one below.

Read More: Formula to Return Blank Cell instead of Zero in Excel

Download the Practice Workbook

Related Articles

<< Go Back to Excel Cells | Learn Excel

Get FREE Advanced Excel Exercises with Solutions!
Lutfor Rahman Shimanto
Lutfor Rahman Shimanto

Lutfor Rahman Shimanto, BSc, Information Technology, Jahangirnagar University, Bangladesh, has worked with the ExcelDemy project for over a year. He has written 50+ articles and provided solutions of 100+ comments for ExcelDemy. Currently, he works as an Excel & VBA Developer and provides support and solutions in the ExcelDemy Forum. He has solved 100+ ExcelDemy Forum problems. His work and learning interests are in developing various Excel & VBA and Desktop applications. Outside of work, he enjoys Chess... Read Full Bio

We will be happy to hear your thoughts

Leave a reply

Advanced Excel Exercises with Solutions PDF