Find Minimum and Maximum Values Between Dynamic Markers in Excel
Question details
Find the minimum and maximum values across columns A:E for each group identified by consecutive markers in column G.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- A worksheet contains numeric values in columns A:E and group markers in column G. Results are needed for each group as markers are added or moved.
- Observed behavior
- Each marker after the first should display the minimum and maximum for the range from the preceding marker row through the current marker row.
Confirm that column G contains nonblank group markers and that columns H and I are available for results. The formulas below include both marker rows in each group's range.
Calculate group minimums and maximums using marker rows
Use LOOKUP to find the preceding marker and INDEX to build a range that changes with each group.
In H2, enter =IF($G2="","",IFERROR(MIN(INDEX($A:$A,LOOKUP(2,1/($G$1:G1<>""),ROW($G$1:G1))):INDEX($E:$E,ROW())),""))
In I2, enter =IF($G2="","",IFERROR(MAX(INDEX($A:$A,LOOKUP(2,1/($G$1:G1<>""),ROW($G$1:G1))):INDEX($E:$E,ROW())),""))
Select H2:I2 and drag the fill handle down alongside the data. Results appear on marker rows that have a preceding marker.

Find group minimums and maximums in WPS Spreadsheets
Use LOOKUP, INDEX, MIN, and MAX in WPS Spreadsheets to calculate values between consecutive marker rows.
- 1. Open the workbook: Open WPS Spreadsheets and select Open to load your Excel workbook.
- 2. Enter the minimum formula: Select H2 and enter =IF($G2="","",IFERROR(MIN(INDEX($A:$A,LOOKUP(2,1/($G$1:G1<>""),ROW($G$1:G1))):INDEX($E:$E,ROW())),""))
- 3. Enter the maximum formula: Select I2 and enter =IF($G2="","",IFERROR(MAX(INDEX($A:$A,LOOKUP(2,1/($G$1:G1<>""),ROW($G$1:G1))):INDEX($E:$E,ROW())),""))
- 4. Fill down and save: Select H2:I2, drag the fill handle down through the marker rows, and use File > Save to save the workbook.

Frequently Asked Questions
Why is the result blank at the first marker?
The formulas need an earlier nonblank cell in column G to define the start of a group. The first marker has no preceding marker, so the result is blank.
Are the marker rows included in each calculation?
Yes. Each formula includes columns A:E from the preceding marker row through the current marker row. A marker row therefore belongs to both adjacent groups.
Why does a group return zero when it has no numbers?
MIN and MAX ignore text and return 0 when the selected range contains no numeric values. Check the group's cells in columns A:E for numbers stored as text or empty cells.
Can I use a different marker or data column?
Yes. Replace the column G references with your marker column, and change the INDEX references to the first and last data columns. Put the formulas in empty result columns.




