I have a column where appear different users and other one that appear a value. Each user can have several of these values and they can be repeated. I know how to count same values in the same column but I need to know the quantity of identical values for each user. For example:

```
USER VALUE
User1 100
User1 300
User1 100
User1 200
User1 300
User1 100
User1 100
User1 400
User2 100
User2 100
User2 100
User2 400
User2 100
User2 200
User2 200
```

Then it should appear something like:

```
USER VALUE COUNT
User1 100 4
User1 200 1
User1 300 2
User1 400 1
```

And same with the second user and so on.

EDIT – Sorry I misunderstood what I had to do… I had more values and I though that I only had to focus in one value but apparently I had to take in count all of them: So What I need is the following:

```
USER V1 V2 V3 V4
user1 A C A B
user2 B D A B
user1 A F A C
user3 C A C D
user3 D B A A
```

What should appear for user1

```
user1
V1
A 2
B 0
C 0
D 0
V2
A 1
B 0
C 0
D 0
E 0
F 1
V3
A 2
B 0
C 0
D 0
V4
A 0
B 1
C 1
D 0
```

Any ideas for that? Anyway thanks for the help!

# EDIT

Added a new Answer below based on new data structure from the original poster.

So a couple things have to happen to get this to work. I reccomend converting your data range into a table. It makes for easy dynamic column and value references. Highlight your data range and hit CTRL+T.

Now say your data is in Cell A1:E6 like you have above

Table1=A1:E6=

```
USER V1 V2 V3 V4
user1 A C A B
user2 B D A B
user1 A F A C
user3 C A C D
user3 D B A A
```

- In cell F2 enter
`=IFERROR(INDEX(Table1[USER],MATCH(0,INDEX(COUNTIF($F$1:F1,Table1[USER]),0,0),0)),"-")`

- This will return the first unique user in your “USER” column. To show

the rest simply Drag Down to copy the formula in the cells below F2. - Then in cell G2 I made a drop down list of range F2:F4, which is all the unique users.
- In cell G3 I made a drop down list of range B1:E1, which is all the Headers V1,V2…
- In cell G4 enter
`=IFERROR(INDEX(INDIRECT("Table1["&$G$3&"]"),MATCH(0,INDEX(COUNTIF($G$3:G3,INDIRECT("Table1["&$G$3&"]")),0,0),0)),"-")`

- You can copy this formula down to cells below it until you see a “-” which means there are no more unique values for column “V1”
- In cell H4 enter
`=COUNTIFS(Table1[USER],$G$2,INDIRECT("Table1["&$G$3&"]"),G4)`

This will all give you something that looks like this… Hope it helps,

# End Edit

FIRST ANSWER…

Here is how you do it with Cell Formulas.

- Range of Users with Header in A:A
- Range of Values with Header in B:B
- Range A:B is sorted by Users and then Values
- In D1:F1 type in your new headers, Unique Users, Unique Values, User Values Count.
- There are three formulas, one for each column.
- D2 =
`=INDEX(A:A,ROW($F$2)+SUM(F$1:F1))`

- E2 =
`=INDEX(B:B,ROW($F$2)+SUM(F$1:F1))`

- F2 =
`=COUNTIFS(A:A,D2,B:B,E2)`

With those three in the second row you should now be able to Drag down the formula to fill the list out more and more showing unique users and their unique values with a count of those values. If the formula returns a zero that means you are at the end of the unique data.

-Scheballs

EDIT- Typo, thanks Jerry

### Answer：

If you’re okay with using a pivot table, then you can do this:

- Select the range (the whole table for instance)
- Go to
`Insert`

>`Insert PivotTable`

>`OK`

- Drag the fields
`User`

,`Value`

in the ‘Row Labels’ box and the`Value`

again in the`Values`

box.

After some formatting (`Report Layout > Tabular Form`

and `Do not show subtotals`

from the `Design`

pane of the PivotTable menu), you get this:

You can then Copy/Paste what you need in another sheet for more data manipulations. *You cannot directly modify data in the PivotTable.*

If you already have the table ready with the `User`

and the `Values`

and only need to get the count, then you use `COUNTIFS`

in the cell C2.

```
=COUNTIFS(Sheet1!A:A,Sheet2!A2,Sheet1!B:B,Sheet2!B2)
```

This formula assumes that the first sheet is named `Sheet1`

and the sheet containing the table you want to fill is named `Sheet2`

.

Tags: excelexcel