Avatar of gregfthompson
gregfthompson
Flag for Australia asked on

De-dupe and count/calculation in Excel

The file has a list of addresses and each address may appear several times with different dates. The address row for each property also includes number of bedrooms. Most properties have between 1 and 6 bedrooms.
The objective is to ignore the dates, de-dupe the list then count the number of properties by number of bedrooms. Then calculate the total number of bedrooms.
The example file contains examples of the three lists.
Suburbs--Properties-Bedrooms2014.xlsx
Microsoft Excel

Avatar of undefined
Last Comment
gregfthompson

8/22/2022 - Mon
Rob Henson

I haven't looked at the file but I suspect the way forward might be a pivot table.

Address as a row header, number of bedrooms as value. Assuming all entries for each address are the same, you can set the number of bedrooms as an average or max or min rather than a sum.

Thanks
Rob H
gregfthompson

ASKER
Hi Rob,

Thanks for your comment.
The existing list is a property addresses  with number of bedrooms and a month and year. Some properties area listed under several different months.
The de-duped list removes the month and year and sorts the properties into suburb by number of bedrooms. Unique properties only.
The final list counts the number of properties under for each number of bedrooms and calculates the total number of bedrooms for each suburb.
In this example, Abbotsford has  96 properties with 1 bedroom, 167 with 2 bedrooms, 25 with 3 bedrooms, 1 with 4 bedrooms, 0 with 5 bedrooms, 1 with 6 bedrooms and 0 with 7 and 8 bedrooms. The total number of bedrooms is 1x96 + 2x167 + 3x25 + 4x1 + 6x1 = 849

Does this make sense?:
Can this be done with a macro?

Thanks,

Greg
Rob Henson

Can you provide some sample data?
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23
gregfthompson

ASKER
Hi Rob,

Thanks for your response.

The sample data is in columns A to J in the attached file.  The de-duped list is in columns L to O and the output sample is in columns Q to AB.

I'm not sure what other data you are seeking.

Thanks,

Greg
gregfthompson

ASKER
PS I've attached the file again
Suburbs--Properties-Bedrooms2014.xlsx
Rob Henson

Greg,

See attached.

Sheet2 - I have created a Pivot Table on the original list to pull out a list of Suburbs and their Post Code.

Sheet1 - Columns Q to AB; copied Suburb and Post Code from Pivot into column Q & R then used COUNTIFS formula to populate count of properties by Suburb and by number of bedrooms. Total column then uses SUMPRODUCT formula to multiply number of properties by number of bedrooms.

I haven't used the de-duped list as I have been able to drive it all from original list.

Hope this is what you need.

Thanks,
Rob H
Copy-of-Suburbs-Properties-Bedrooms2014.
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
gregfthompson

ASKER
Thanks Rob,

I have never seen or used Pivot tables and after I unzipped this download I could not work out how to find the worksheets.

I've had at look at Microsoft help on Pivot Tables and I'm still unable to work out how to open them.

Is there a better tutorial you can recommend?  I have about a 160,000 rows that I want to sort.

Thanks,

Greg
Rob Henson

The upload should not have needed unzipping. I uploaded an excel file with two sheets.
gregfthompson

ASKER
Thanks Rob.

The file named Copy-of-Suburbs-Bedrooms2014 downloads as a zipped file. Lots of xml - no xlsx sheets anywhere that I can find.

Can you upload it again?

Thanks,

Greg
PS I've attached the file that downloads
Copy-of-Suburbs-Properties-Bedrooms2014-
Your help has saved me hundreds of hours of internet surfing.
fblack61
Rob Henson

Ok, I have just been able to download it correctly.

When I click on the file link in the message, I see the usual download window with two options: Open With or Save.

As the file isn't recognised, the Save option is checked. I selected the Open With option and clicked the Browse button to choose Excel. I got an error message saying that file was in different format but clicked Yes to open anyway. The file opened fine in Excel and can see the two sheets as expected. Click on the Enable Editing button at the top to get full functionality.

If this looks like want you want, I will walk you through creating the Pivot table. There are a couple of more advanced options that you might want to use as well.

Thanks
Rob H
gregfthompson

ASKER
Thanks Rob,

It's now open.  I'll have a good look at it and see if I can gain more understanding.

I'll try to get back to you tomorrow.

Thanks again,

Greg
gregfthompson

ASKER
PS Apologies for not responding more quickly.
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
Rob Henson

No worries, hope it does what you want.
gregfthompson

ASKER
Hi Rob,

I have no idea how you did this but I think I can use it by simply copying in the total list on sheet 2.

The only missing data is the count for number of properties by bedrooms. I'm seeking to know how many properties for 1 bedroom, how many properties for 2 bedroom and same for 3 bedroom, 4 bedroom, 5 bedroom, 6 bedroom 7 bedroom and 8 bedroom.

Can the pivot table show these totals in sheet 1?

Thanks again,

Greg
gregfthompson

ASKER
PS It is very elegant - love the way it works.
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes
gregfthompson

ASKER
PPS. Oops, error.  Where I mention sheet 1, I mean sheet 2 and where I mention sheet 2, I mean sheet 1.
Rob Henson

The table of COUNTIFS formulas shows the count by number of bedrooms. Not sure what you're missing.
gregfthompson

ASKER
I know this must sound silly but I can't find COUNTIFS. I have found the COUNT and it then changes to Count of Bed,

I'm sorry. I've had a good look at the Pivot Table tutes but still do not understand how it works.
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
ASKER CERTIFIED SOLUTION
Rob Henson

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
gregfthompson

ASKER
Thanks Rob. Beautiful work.

PS. I'm using Excel 2010.
Rob Henson

Glad we got there in the end. If you want some basic tips for pivot tables, let us know.

Thanks
Rob
gregfthompson

ASKER
Hi rob,

Thanks.

I copied about 160,000 rows into the data section.  But I don't know how to get it recognised so that it will work.
I am lost at the moment.

Where isthe pivot table data cell specification?

Thanks,

Greg
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck
Rob Henson

You will have to update the pivot to include the new data.

Go to pivot tab and put cursor anywhere in table. Blue borders will appear around the table and a couple of extra items will appear; a pane on right hand side listing the available columns from the data and a quad pane where you drag the column fields for displaying in the table. There will also be a new group on the ribbon tool bar. In this group select the options tab and immediately below there is an option to change data source. Click this and a range browser window will appear showing existing data range. If you know the row number you can edit the range manually or use keys or mouse to select the range. Click Ok and the pivot will update. You can then copy and paste the suburb and post code from refreshed pivot into summary sheet. Copy down the formulas to the extent of your new list.

If the data gets updated regularly this can be automated so that the data range used in the pivot updates and you only need to refresh the table and do the copy & paste.

Thanks
Rob
gregfthompson

ASKER
Thanks Rob.

All perfect. Thanks again so much!!!