How to Skip Rows Based on a Value Using an Excel Formula (7 Examples)

Example 1 – Using the FILTER Function

In the first example, we are going to use the FILTER function to skip rows based on value using the Excel formula. For that, we consider a dataset that has the name and gender of five employees of a company. Our dataset is in the range of cells B5:C9, and we will show our result in column E.

  • Select cell E5.
  • Enter the following formula. This formula will skip rows where the gender of the employees is Female:

=FILTER(B5:B9,C5:C9="Male")

  • Press Enter.

Utilizing FILTER Function to Skip Rows for Specific Value

  • You’ll see that the two rows with female employees are skipped, and the names of the other three employees appear in column E.

Read More: How to Skip Cells in Excel Formula


Example 2 – Applying the OFFSET Function

In this example, we will use the OFFSET function to skip rows based on value using the Excel formula. To demonstrate the example, we consider a dataset of 12 months with gradually increased points, and we will show our result in columns E and F. We want to get the rows after every two rows.

  • Select cell E6.
  • Enter the following formula to get the name of the months:

=OFFSET($B$5,ROW(E1)*3-1,0)

  • Press Enter.

Applying OFFSET Function to Skip Two Months Row Using Excel Formula

  • Select cell F6 and enter this formula to get the corresponding points:

=OFFSET($C$5,ROW(F1)*3-1,0)

  • Press Enter.

Applying OFFSET Function for Skipping Points Rows by Excel Formula

  • Drag the Fill Handle icon from E6:F6 to copy the formulas up to cell F9.
  • You’ll notice that four rows are copied, and the other two rows in between are skipped.

Skip Every Two Rows and Get Third One Based on Value Through Excel Formula

Read More: How to Skip Columns in Excel Formula


Example 3 – Using the INDEX and ROW Functions

In the following example, we are going to use the INDEX and ROWS functions to skip rows based on value. Our dataset is in the range of cells B5:B14. We will skip each row after the employee’s name and show our result in column D. We will follow the same steps to obtain the salary.

  • Select cell D5.
  • Enter the following formula to get the name of the employees:

=INDEX($B$5:$B$14,ROWS($E$5:E5)*2-1)

  • Press Enter.

Skip Other Rows to Get Employee Name

  • Select cell E5 and enter this formula to get the salary of that employee:

=INDEX($B$5:$B$14,ROWS($E$5:E5)*2)

  • Press Enter.

Skip Other Rows to Get the Value of Salary

  • Select the range of cells D5:E5 and drag the Fill Handle icon to copy the formulas up to cell F7.
  • You’ll see that all the names and salaries are displayed in a column, with every row in between skipped.

Using INDEX and ROW Functions to Skip Based on Value

Breakdown of the Formula (for cell D5)

  • ROWS($E$5:E5): The ROWS function returns the row number. In this case, it returns 1.
  • INDEX($B$5:$B$14, ROWS($E$5:E5)*2-1): The INDEX function uses the result of the ROWS function to retrieve the value from the specified row range. In this example, the value is Harry.

Read More: How to Skip Cells When Dragging in Excel


Example 4 – Combining INDEX, AGGREGATE and ROW Functions

The IFERROR, INDEX, AGGREGATE, and ROW functions will help us to skip rows based on value using the Excel formula. For that, we consider a dataset that has the names and genders of five employees of a company. Our dataset is in the range of cells B5:C9, and we will show our result in columns E and F.

  • Select cell E5.
  • Enter the following formula to get the name of the employees:

=IFERROR(INDEX($B$5:$B$9,AGGREGATE(15,6,1/($C$5:$C$9="Male")*(ROW($C$5:$C$9)-ROW($C$4)),(ROW()-ROW($E$4)))),"")

  • Press Enter.

Skip Employee's Name Rows Based on Value

  • Select cell F5 and enter the following formula to get the gender of that employee.

=IFERROR(INDEX($C$5:$C$9,AGGREGATE(15,6,1/($C$5:$C$9="Male")*(ROW($C$5:$C$9)-ROW($C$4)),(ROW()-ROW($E$4)))),"")

  • Press Enter.

Skip Employee's Salary Based no Value

  • Drag the Fill Handle icon from E5:F5 to copy the formulas up to cell F7.
  • You’ll get the names and salaries of male employees, with female employees’ rows skipped.

Combining INDEX, AGGREGATE and ROW Functions to Get Desired Row

Breakdown of the Formula (for cell E5)

  • ROW($E$4): Shows the row number of cell E4 (value is 4).
  • ROW(): Returns the row number of the current cell (row number is 5).
  • ROW($C$4): Displays the row number of cell C4 (value is 4).
  • ROW($C$5:$C$9): Provides the row numbers for cells C5 to C9.
  • AGGREGATE(15, 6, 1/($C$5:$C$9=”Male”)*(ROW($C$5:$C$9)-ROW($C$4)), (ROW()-ROW($E$4))): Using values from the ROW function, AGGREGATE determines which rows to display. For this cell, the value is 1.
  • INDEX($B$5:$B$9, AGGREGATE(15, 6, 1/($C$5:$C$9=”Male”)*(ROW($C$5:$C$9)-ROW($C$4)), (ROW()-ROW($E$4)))): INDEX retrieves the value based on the AGGREGATE result. Here, it returns Harry.
  • IFERROR(INDEX($B$5:$B$9, AGGREGATE(15, 6, 1/($C$5:$C$9=”Male”)*(ROW($C$5:$C$9)-ROW($C$4)), (ROW()-ROW($E$4)))), “”): IFERROR checks the INDEX result. If valid, it shows the value; otherwise, it returns a blank.

Example 5 – Skip Blank Rows

In this example, we will skip the blank rows using a formula. The FILTER function will assist in skipping the blank rows. Our dataset is in the range of cells B5:C13, and there are four blank rows. We will show our results in columns E and F.

  • Select cell E5.
  • Enter the following formula to skip blank rows:

=FILTER(B5:C13,(B5:B13<>"")*(C5:C13<>""))

  • Press Enter.

Skip Blank Rows Using FILTER Function

  • You’ll see that all blank rows are skipped, and only rows with values are displayed in columns E and F.

Read More: How to Skip to Next Cell If a Cell Is Blank in Excel


Example 6 – Skip Rows That Are Less Than a Specific Value

In this example, we will skip rows that have a value less than our desired value. The IFERROR, INDEX, AGGREGATE, and ROW functions will help us. We consider a dataset that has the names and points of five employees of a company. Our dataset is in the range of cells B5:C9, and we will show our result in columns E and F.

  • Select cell E5.
  • Enter the following formula to get the names of the employees with less than 50 points:

=IFERROR(INDEX($B$5:$B$9,AGGREGATE(15,6,1/($C$5:$C$9<50)*(ROW($C$5:$C$9)-ROW($C$4)),(ROW()-ROW($E$4)))),"")

  • Press Enter.

Skipping Employee Name Rows That Are Less Than Specific ValueUsing Ecel

  • Select cell F5 and enter this formula to get the points of those employees:

=IFERROR(INDEX($C$5:$C$9,AGGREGATE(15,6,1/($C$5:$C$9<50)*(ROW($C$5:$C$9)-ROW($C$4)),(ROW()-ROW($E$4)))),"")

  • Press Enter.

Skipping Points Rows That Are Less Than Specific Value Using Excel Formula

  • Select the range of cells E5:F5 and drag the Fill Handle icon to copy the formulas up to cell F7.
  • You’ll see the names of employees whose points are less than 50 displayed in the desired location.

Skipping Rows That Are Less Than Specific Value

Breakdown of the Formula (for cell E5)

  • ROW($E$4) returns the row number of cell E4, which is 4.
  • ROW() returns the row number of the current cell (E5), which is 5.
  • ROW($C$4) returns the row number of cell C4, which is 4.
  • ROW($C$5:$C$9) provides the row numbers for cells C5 to C9.
  • AGGREGATE(15,6,1/($C$5:$C$9<50)*(ROW($C$5:$C$9)-ROW($C$4)),(ROW()-ROW($E$4))) determines which row’s value to display. In this case, it’s row 4.
  • INDEX($B$5:$B$9,AGGREGATE(15,6,1/($C$5:$C$9<50)*(ROW($C$5:$C$9)-ROW($C$4)),(ROW()-ROW($E$4))) retrieves the value from column B corresponding to row 4, which is Chris.
  • IFERROR(…,””) ensures that if there’s an error (e.g., no valid value), it returns a blank cell.

Example 7 – Skip Rows That Are Greater Than a Specific Value

In our last example, we are going to use the IFERROR, INDEX, AGGREGATE, and ROW functions to skip rows where the values are greater than a specific value. We consider a dataset that has the names and points of five employees of a company. Our dataset is in the range of cells B5:C9, and we will show our result in columns E and F.

  • Select cell E5.
  • Enter the following formula to get the names of the employees with more than 50 points:

=IFERROR(INDEX($B$5:$B$9,AGGREGATE(15,6,1/($C$5:$C$9>50)*(ROW($C$5:$C$9)-ROW($C$4)),(ROW()-ROW($E$4)))),"")

  • Press Enter.

Skipping Employee Name Rows That Are Greater Than Specific Value

  • Select cell F5 and enter this formula to get the points of those employees:

=IFERROR(INDEX($C$5:$C$9,AGGREGATE(15,6,1/($C$5:$C$9="Male")*(ROW($C$5:$C$9)-ROW($C$4)),(ROW()-ROW($E$4)))),"")

  • Press Enter.

Skipping Points Rows That Are Greater Than Specific Value

  • Select the range of cells E5:F5 and drag the Fill Handle icon to copy the formulas up to cell F6.
  • You’ll see the names of employees whose points are greater than 50 displayed in the desired location.

Skipping Rows That Are Greater Than Specific Value Using Formula

Breakdown of the Formula (for cell E5)

  • ROW($E$4): The function shows the row number of cell E4. Here, the value is 4.
  • ROW(): The function returns the row number of this cell. The row number is 5.
  • ROW($C$4): The ROW function shows the row number of cell C4. Here, the value is 4.
  • ROW($C$5:$C$9): Here, the function provides us with the row number of the cells C5 to C9.
  • AGGREGATE(15,6,1/($C$5:$C$9>50)*(ROW($C$5:$C$9)-ROW($C$4)),(ROW()-ROW($E$4))): Using all the values from the ROW function the AGGREGATE function returns which rows value have to show. For this cell, the value will be 2.
  • INDEX($B$5:$B$9,AGGREGATE(15,6,1/($C$5:$C$9>50)*(ROW($C$5:$C$9)-ROW($C$4)),(ROW()-ROW($E$4))): The INDEX function will use the result of the AGGREGATE function and display the value of the cell. Here, the value returns Ron.
  • The IFERROR(…,””): The IFERROR function checks the result of the INDEX function. If the INDEX function returns any valid value the function will show it. Otherwise, the function will return a blank. Here, the function returns Ron.

Read More: Skip to Next Result with VLOOKUP If Blank Cell Is Present


Download Practice Workbook

You can download the practice workbook from here:


Related Articles


<< Go Back to Excel Cells | Learn Excel

Get FREE Advanced Excel Exercises with Solutions!
Soumik Dutta
Soumik Dutta

Soumik Dutta, having earned a BSc in Naval Architecture & Engineering from Bangladesh University of Engineering and Technology, plays a key role as an Excel & VBA Content Developer at ExcelDemy. Driven by a profound passion for research and innovation, he actively immerses himself in Excel. In his role, Soumik not only skillfully addresses complex challenges but also demonstrates enthusiasm and expertise in gracefully navigating tough situations, underscoring his unwavering commitment to consistently deliver exceptional, high-quality content that... Read Full Bio

We will be happy to hear your thoughts

Leave a reply

Advanced Excel Exercises with Solutions PDF

 

 

ExcelDemy
Logo