Filtering in excel

Natnat C 0 Reputation points
2026-04-24T16:15:14.4633333+00:00

Hello! I am trying to see how many times data repeats in 1 column and then filter by number. I then want to hide the duplicates. I was able to get the data by using countif but it only filters using all the data. I want to hide the duplicates once I have those counts. I tired to create a new column using unique and then countif but I get the error message of 'you can't change part of the array.' Is there another way? Thank you!!

Microsoft 365 and Office | Excel | For home | Windows

1 answer

Sort by: Most helpful
  1. AI answer

    2026-04-24T16:15:32.5033333+00:00

    Use Excel’s built‑in tools for unique/duplicate handling instead of editing the UNIQUE array directly.

    To hide duplicates (show only unique values):

    1. Select the column that contains the data.
    2. On the Data tab, in the Sort & Filter group, select Advanced.
    3. In Advanced Filter:
      • Choose Filter the list, in‑place (to hide duplicates in the same column), or Copy to another location (to put the unique list somewhere else).
      • Check Unique records only.
      • If using Copy to another location, set Copy to to an empty cell.
    4. Select OK.
      • If you chose Filter the list, in‑place, only unique values remain visible and duplicates are hidden.
      • If you chose Copy to another location, the new range contains only unique values.

    To count how many unique values there are:

    1. After using Advanced Filter to copy unique values to a new column (for example, B2:B45),
    2. In a blank cell below that list, enter:
         =ROWS(B2:B45)
      
      This returns the number of unique values.

    The error “you can’t change part of an array” appears because formulas like UNIQUE create dynamic arrays that cannot be partially edited. Use Advanced Filter instead when needing to manipulate or filter the resulting list.


    References:

    AI-generated content may be incorrect. Read our transparency notes for more information.

    Was this answer helpful?

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.