Excel help needed - merging data
Excel help needed - merging data
Author
Discussion

boyse7en

Original Poster:

8,250 posts

196 months

Wednesday 30th May 2018
quotequote all
Any Excel gurus out there that can help me?

I'm being supplied a large spread sheet of sales figures once a quarter. Its about 3500 rows in total, so a bit of a handful to do any manual editing.

An example few rows of data is:

[b]
Make Model cc month class total sales[/b]
BMW F 700 GS 798 1 Motorcycle 8
BMW F 700 GS 798 3 Motorcycle 46
BMW F 700 GS 798 2 Motorcycle 11
BMW F 800 GS 798 3 Motorcycle 39
BMW F 800 GS 798 2 Motorcycle 4
BMW F 800 GS 798 1 Motorcycle 12
BMW F 800 GS ADVENTURE 798 3 Motorcycle 17
BMW F 800 GS ADVENTURE 798 1 Motorcycle 5
BMW F 800 GS ADVENTURE 798 2 Motorcycle 5

As you can see, all models have three separate entries - one for each month (this is for first quarter).
What I'd like to do is to amalgamate these so that each model has only one row, with the total sales being the sum of the three entries.
Is there a way to do this without having to go through the whole spreadsheet manually?

FunkyGibbon

3,865 posts

295 months

Wednesday 30th May 2018
quotequote all
Google pivot tables. They will do what you need.

sgrimshaw

7,587 posts

281 months

Wednesday 30th May 2018
quotequote all
Are you actually getting a spreadsheet, a .xls or .xlsx file ?


Doofus

34,743 posts

204 months

Wednesday 30th May 2018
quotequote all
Pivot tables can be a pain if you're not familiar and need something quick.

Copy the column with the models in it and paste it into a new column. Highlight the new column and choose "Data", "Remove Duplicates"

In the column next to that, enter " =SUMIF(B:B,J2,F:F) where column B is the original list of models, J2 is the first of the deduplicated list of models, and column F contains the sales numbers.

Copy that formula down next to each of the deduplicated model numbers.

sgrimshaw

7,587 posts

281 months

Thursday 31st May 2018
quotequote all
Doofus said:
... some good stuff...
Thanks for that, I just followed your advice and saved myself the joy (not!) of using a pivot table thumbup

Doofus

34,743 posts

204 months

Thursday 31st May 2018
quotequote all
smile

weeboot

1,065 posts

130 months

Thursday 31st May 2018
quotequote all
Doofus said:
Pivot tables can be a pain if you're not familiar and need something quick.
Which is why you should become familiar with them, as once you are they're quick and easy to use!

boyse7en

Original Poster:

8,250 posts

196 months

Thursday 31st May 2018
quotequote all
Doofus said:
Pivot tables can be a pain if you're not familiar and need something quick.

Copy the column with the models in it and paste it into a new column. Highlight the new column and choose "Data", "Remove Duplicates"

In the column next to that, enter " =SUMIF(B:B,J2,F:F) where column B is the original list of models, J2 is the first of the deduplicated list of models, and column F contains the sales numbers.

Copy that formula down next to each of the deduplicated model numbers.
Your method works like a dream...

however, i'm now trying to learn pivot table basics as i think they might be useful to release even more information (I'm a graphic designer tasked with making a page of sale figures look interesting)

weeboot

1,065 posts

130 months

Thursday 31st May 2018
quotequote all
boyse7en said:
Your method works like a dream...

however, i'm now trying to learn pivot table basics as i think they might be useful to release even more information (I'm a graphic designer tasked with making a page of sale figures look interesting)
You can build a pretty nice dashboard with a combination of pivot tables, pivot charts, slicers and timelines...

Happy to give you a hand if you're happy to send some data my way?

Doofus

34,743 posts

204 months

Thursday 31st May 2018
quotequote all
boyse7en said:
Your method works like a dream...

however, i'm now trying to learn pivot table basics as i think they might be useful to release even more information (I'm a graphic designer tasked with making a page of sale figures look interesting)
My method isn't fancy; it's just quick and dirty. It's also not dynamic - if you add a new model, it won't automatically update the sales totals.

My problem with pivot tables is that because you can do so much with them, it's possible to overload the reader with data, and lose the information.

I had a chap write a report for my Board once, based on Excel data. It was essentially sales by product by month. He produced a suite of reports which covered six sides of A4. Because he could show the numbers in lots of different ways, he did, and most of it was irrelevant. Sales of item A in June, versus sales of (unrelated) item G in February for instance.

Consequently, I tend to advise the use of pivots with caution. They also make me nervous because I've seen people use them without ever really paying attention to the data or to the results, because it's quick, easy and looks flash.

I admit, I'm old, and learned on Lotus 1-2-3 before pivots were a twinkle in Microsoft's eye, and I'm not against making things better, but sometimes I just want information, not data.

weeboot

1,065 posts

130 months

Thursday 31st May 2018
quotequote all
Doofus said:
sometimes I just want information, not data.
You're absolutely right! That's where the skill of using Excel properly comes in.
Unfortunately, the idea of that seems to be spread pretty thinly across the user base!

boyse7en

Original Poster:

8,250 posts

196 months

Friday 1st June 2018
quotequote all
Doofus said:
My method isn't fancy; it's just quick and dirty. It's also not dynamic - if you add a new model, it won't automatically update the sales totals.

My problem with pivot tables is that because you can do so much with them, it's possible to overload the reader with data, and lose the information.

I had a chap write a report for my Board once, based on Excel data. It was essentially sales by product by month. He produced a suite of reports which covered six sides of A4. Because he could show the numbers in lots of different ways, he did, and most of it was irrelevant. Sales of item A in June, versus sales of (unrelated) item G in February for instance.

Consequently, I tend to advise the use of pivots with caution. They also make me nervous because I've seen people use them without ever really paying attention to the data or to the results, because it's quick, easy and looks flash.

I admit, I'm old, and learned on Lotus 1-2-3 before pivots were a twinkle in Microsoft's eye, and I'm not against making things better, but sometimes I just want information, not data.
I'm all about the result, not the techniques, for this.
Like I said, I'm a designer, not an data analyst and my aim is to try and get tables and charts that my readership of non-experts can understand.


boyse7en

Original Poster:

8,250 posts

196 months

Friday 1st June 2018
quotequote all
weeboot said:
You can build a pretty nice dashboard with a combination of pivot tables, pivot charts, slicers and timelines...

Happy to give you a hand if you're happy to send some data my way?
Ooh, that sounds a good offer. It would be nice to see what is achievable.
Can i email it to you?

weeboot

1,065 posts

130 months

Friday 1st June 2018
quotequote all
boyse7en said:
Ooh, that sounds a good offer. It would be nice to see what is achievable.
Can i email it to you?
sure
wildotperryatgmaildotcom

boyse7en

Original Poster:

8,250 posts

196 months

Wednesday 6th June 2018
quotequote all
Thanks to some sterling help from Weeboot (OK, he did all the hard work, I just fiddled about at the edges) i've got a nicely workable pivot table with tables, slicers and all sorts of refinements.

Before I can use it to full effect though, i need to clean up some of the data. I've got a macro that does multiple search and replace operations based on a table i have inserted in the worksheet and it works just fine.

What I'd like to do is to highlight cells that have been changed by the macro, but i'm having a bit of trouble with it.
I thought that i could simply use the Track Changes function, but that doesn't seem to be allowed on worksheets with pivot tables on.

So then i tried to mess about with the macro but only managed to get it to change the colour of all the cells whether or not the contents had changed.

My script is:
Sub MultiFindNReplace()
Dim Rng As Range
Dim InputRng As Range, ReplaceRng As Range
xTitleId = "Multiple Replace"
Set InputRng = Application.Selection
Set InputRng = Application.InputBox("Original Range ", xTitleId, InputRng.Address, Type:=8)
Set ReplaceRng = Application.InputBox("Replace Range :", xTitleId, Type:=8)
Application.ScreenUpdating = True
Application.DisplayAlerts = False
For Each Rng In ReplaceRng.Columns(1).Cells
InputRng.Replace what:=Rng.Value, replacement:=Rng.Offset(0, 1).Value
Next
Application.DisplayAlerts = True
End Sub

Can anyone with a bit of knowledge of this sort of stuff have a look and help me adapt it to highlight cells it has changed (either the colour of the cell, or the text colour, or similar - just so I know which cells have or haven't changed)

weeboot

1,065 posts

130 months

Wednesday 6th June 2018
quotequote all
I'd approach it with an IF statement to suggest that IF the value is one you wish to replace, replace it and change the colour of the cell...