Link to home
Create AccountLog in
Avatar of gregfthompson
gregfthompsonFlag 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
Avatar of Rob Henson
Rob Henson
Flag of United Kingdom of Great Britain and Northern Ireland image

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
Avatar of 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
Can you provide some sample data?
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
PS I've attached the file again
Suburbs--Properties-Bedrooms2014.xlsx
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.
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
The upload should not have needed unzipping. I uploaded an excel file with two sheets.
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-
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
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
PS Apologies for not responding more quickly.
No worries, hope it does what you want.
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
PS It is very elegant - love the way it works.
PPS. Oops, error.  Where I mention sheet 1, I mean sheet 2 and where I mention sheet 2, I mean sheet 1.
The table of COUNTIFS formulas shows the count by number of bedrooms. Not sure what you're missing.
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.
ASKER CERTIFIED SOLUTION
Avatar of Rob Henson
Rob Henson
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Thanks Rob. Beautiful work.

PS. I'm using Excel 2010.
Glad we got there in the end. If you want some basic tips for pivot tables, let us know.

Thanks
Rob
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
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
Thanks Rob.

All perfect. Thanks again so much!!!