How can I highlight a max value in a column based on date criteria in corresponding rows.

Anonymous
2025-04-15T16:33:04+00:00

Hello, I have the following table of data with columns, "start_date", and "Total". If the date in column A is a single date, then I need to highlight the 'Total' (column B) cell for that row (or the entire row if that is easier). If there are rows of consecutive dates, I need to find the max value of those dates in the corresponding 'Total column' and highlight it (again either cell or entire row). For example...I put a box around the rows with consecutive dates to see better. I have anywhere from 5,000 - 15,000 rows of this data and in desperate need of help.

Thank You

Microsoft 365 and Office | Excel | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments
{count} votes

3 answers

Sort by: Most helpful
  1. Anonymous
    2025-04-15T18:27:02+00:00

    I have assumed that your data is sorted by date, ascending.

    This solution uses another column of formulas.

    In C2, enter 1

    In C3, enter the formula

    =IF(A3=A2+1,C2,C2+1)

    and copy down.

    Then select all of column B (B2 to the bottom) and use Conditional formatting, New Rule, Use a formula to decide.... and the formula

    =B2=MAXIFS(B:B,C:C,C2)

    And choose you highlight color and press OK.

    You can get a summary of the dates and their corresponding values in a table by using this Spill formula (which needs the third column of formulas):

    =LET(d,HSTACK(FILTER(A:B,A:A<>""),VSTACK("Max",BYROW(VSTACK(1,LET(g,A3:A22=A2:A21+1,SCAN(1,g,LAMBDA(a,v,IF(v,a,a+1))))),LAMBDA(a,MAXIFS(B:B,C:C,a))))),VSTACK({"Date","Value"},DROP(FILTER(d,INDEX(d,,2)=INDEX(d,,3)),,-1)))

    0 comments No comments
  2. Ashish Mathur 101K Reputation points Volunteer Moderator
    2025-04-17T03:24:54+00:00

    Hi,

    In cell C2, type 0. In cell C3, enter this formula and drag down

    =IF(A3-A2=1,C2,MAX(C$2:C2)+1)

    Enter this conditional formatting formula in cell B2 and paste the formatting down

    =$B2=MAXIFS($B$2:$B$16,$C$2:$C$16,$C2)

    0 comments No comments
  3. Anonymous
    2025-04-17T13:41:25+00:00

    Since you are incrementing only on changes, and filling the previous value down when there is no change, the max value is always in the cell above the formula with the cell, so

    MAX(C$2:C2)+1

    is unneeded, and can be simply

    C2+1

    That may speed up calculation.

    0 comments No comments