DEV Community

Andrews
Andrews

Posted on • Originally published at geekexcel.com on

Excel Formulas to Highlight the Alternating Groups of N Rows!!

In Excel, it is easy to highlight every other row. But, have you ever tried to color the rows alternately based on a certain group. Today, I can introduce a simple formula to highlight the alternating groups of N rows in Excel. Let’s see them below!! Get an official version of ** MS Excel** from the following link: https://www.microsoft.com/en-in/microsoft-365/excel

Highlight alternating groups
Highlight alternating groups

General Formula:

  • If you want to highlight rows in groups of “n” in Excel, you can use the below formula.

=ISEVEN(CEILING(ROW()-offset,n)/n)

Syntax Explanations:

  • ISEVEN – In Excel, this function will help to return TRUEwhen a numeric value is even, and FALSEfor odd numbers. Read more on the ISEVEN Function.
  • CEILING ** – The **CEILING function is used to round a given number to the nearest specified multiple.
  • ROW – In Excel, the ROW function helps to return the row number for reference.
  • N – It represents the grouping values.
  • Comma symbol (,) – It is a separator that helps to separate a list of values.
  • Parenthesis () – The main purpose of this symbol is to group the elements.

Practical Example:

Let’s consider the below example.

  • First, we will enter the input values in Column B to Column D.
  • Here we are going to highlight the alternative group values.

Input Ranges
Input Ranges

Result
Result

Wind-Up:

We have described the simple formula to highlight the alternating groups of N rows in Excel from this short tutorial. Hope you like it. Please feel free to state your query or feedback for the above article. To learn more, check out Geek Excel *and Excel Formulas *!!

Read Ahead:

Top comments (0)