count distinct column values in pivot table?

jennxf

New Member
Joined
Jul 12, 2013
Messages
19
[TABLE="class: grid, width: 500, align: center"]
<tbody>[TR]
[TD]sentiment score
[/TD]
[TD]1
[/TD]
[TD]1
[/TD]
[TD]0.9
[/TD]
[TD]0.9
[/TD]
[TD]0.8
[/TD]
[TD]0.8
[/TD]
[/TR]
[TR]
[TD]count
[/TD]
[TD]300
[/TD]
[TD]250
[/TD]
[TD]5
[/TD]
[TD]3
[/TD]
[TD]2
[/TD]
[TD]16
[/TD]
[/TR]
</tbody>[/TABLE]
I have a pivot table here with columns equal to sentiment scores.

I would like to sump up distinct values for each sentiment score to get something like this:

[TABLE="class: grid, width: 500, align: center"]
<tbody>[TR]
[TD]sentiment score
[/TD]
[TD]1
[/TD]
[TD]0.9
[/TD]
[TD]0.8
[/TD]
[/TR]
[TR]
[TD]count
[/TD]
[TD]550
[/TD]
[TD]8
[/TD]
[TD]18
[/TD]
[/TR]
</tbody>[/TABLE]
Is this possible for excel 2011 for Mac?

Thanks!
J
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
Hello,

Using the "Sentiment score" as a pivot field should do just that (sum up per value).

So if you pull the "Sentiment score" field to the column label section of the pivot table, you should be fine.

If not, it may be that your scores, although displayed as similar values, are in fact slightly different behind the comma and Excel sees them as different values (for instance, the two 0.9 score may be 0.86 and 0.87).
> In number format, try displaying additional positions behind the comma to verify this.

Cheers,
drW
 
Upvote 0
Hi drW,

Yes the numbers are infact something like 0.87 or 0.86 but i already changed the entire column to 1 decimal place before transforming it to a pivot table. How can i ensure that excel doesnt see the hidden values?

Thanks!

Hello,

Using the "Sentiment score" as a pivot field should do just that (sum up per value).

So if you pull the "Sentiment score" field to the column label section of the pivot table, you should be fine.

If not, it may be that your scores, although displayed as similar values, are in fact slightly different behind the comma and Excel sees them as different values (for instance, the two 0.9 score may be 0.86 and 0.87).
> In number format, try displaying additional positions behind the comma to verify this.

Cheers,
drW
 
Upvote 0
Hello,

When you say you have changed the number before assembling them into the pivot table, do you mean that:
- you have changed its number format to display only one decimal?
- or that you have actually rounded up the number so that the number are exactly, mathematically, equal, i.e. they are exactly 0.9?

To verify what Excel "sees" in the pivot table, I'd recommend you change the number format of the sentiment score row in the pivot table (not in the source data) to display 3 decimals - this is to check whether the columns are different or not.

To effectively round up the source number to 1 decimal, use the ROUND function on your source data (in another column) as follows: = ROUND ( Number, 1)
- where 'Number' is your source number, and '1' is the number of decimal positions.

Then use this new column (containing the rounded up values) as the source data for your pivot field.

Does that work for you?

Cheers,
drW
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,230
Messages
6,170,883
Members
452,364
Latest member
springate

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top