In a pivot table, return the value in one column (to be summed) if another column has a value in it

tgappmayer

New Member
Joined
Nov 10, 2016
Messages
1
Hey everyone! First post here, please forgive my ignorance.

I've got a pivot table I'm trying to build, and I need your help. Here is what my source data looks like:

NameCityLike cats?Like dogs?Like snakes?# Of Facebook Friends
JohnAtlantaYes300
SusieChicagoYesYes250
MaryChicagoYes700
JackChicagoYes145
JoeSeattleYesYes400

<tbody>
</tbody>

In the above example, what I would like to do is end up with a pivot table that looks like this:
CityLikes CatsLikes DogsLikes SnakesTotalTotal Unique
Chicago2503957001,3451,095
Atlanta300300300
Seattle400400800400

<tbody>
</tbody>


The two parts that I'm struggling with here are 1. counting '# of Facebook friends' if there is a value in columns B-D respectively, and then 2. Determining how to return a unique value to stop a particular row from being double or triple counted.

Thanks in advance for your help!
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
Add to the source data an auxiliary column with this formula:

=IF(C2<>"","Likes Cats",IF(D2<>"","Likes Dogs",IF(E2<>"","Likes Snakes","")))

Then on the pivot table, use that extra column in the column label, the City in the row label and the Sum of Facebook friends in Values.

I hope this is what you wanted.
 
Upvote 0

Forum statistics

Threads
1,214,919
Messages
6,122,260
Members
449,075
Latest member
staticfluids

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