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

2 answers

Sort by: Most helpful
  1. TechyTools 0 Reputation points
    2026-12-04T12:54:23.44+00:00

    Hi @Natnat C,

    The "you can't change part of the array" message appears because UNIQUE spills its results into several cells, and Excel will not let you edit only part of that spill range. A simple helper column avoids that problem and lets you filter duplicates easily.

    Try these steps:

    1. In a new helper column next to your data, enter =COUNTIF($A$2:$A$100,A2) and fill it down to count repeats for each row.
    2. Select your data and helper column, then go to Data > Filter.
    3. Filter the helper column to show only 1 — this hides all duplicate rows and leaves one copy of each value.
    4. If you want to delete duplicates permanently, copy the data first, then go to Data > Remove Duplicates on the copy.

    Keep your original data untouched until you are sure the filtered result is correct.

    Drafted with AI help (Muse) and reviewed by me.

    Was this answer helpful?

    0 comments No comments

  2. 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.