Excel help needed - merging data
Discussion
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?
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?
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.
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.
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...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.
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)
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... 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)
Happy to give you a hand if you're happy to send some data my way?
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.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 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.
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.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.
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.
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.Happy to give you a hand if you're happy to send some data my way?
Can i email it to you?
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)
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)
Gassing Station | Computers, Gadgets & Stuff | Top of Page | What's New | My Stuff




