Combining data from 2 rows into 1

MiniD011

New Member
Joined
Jan 29, 2013
Messages
7
Hi guys,

I am working on a project at the moment which requires information from 2 different sources to be consolidated into just one row with the title.

To give an example, I have two football teams, team 1 & 2 (because I'm feeling creative you see). If I am tracking their progress monthly and I end up with two tables, each with 3 fields, to track which teams they played and the goals scored, I would get something like the following:

Team 1</SPAN>
Team 2</SPAN>
Team Played</SPAN>
Goals Scored</SPAN>
Team Played</SPAN>
Goals Scored</SPAN>
Team 3</SPAN>
2</SPAN>
Team 3</SPAN>
1</SPAN>
Team 4</SPAN>
1</SPAN>
Team 7</SPAN>
0</SPAN>
Team 5</SPAN>
0</SPAN>
Team 8</SPAN>
4</SPAN>
Team 6</SPAN>
3</SPAN>
Team 4</SPAN>
1</SPAN>

<TBODY>
</TBODY>


If I then want to make a list to know how many goals the opposing teams (3-8) have conceded, regardless of who they were against, what would be the best way to do this automatically, preferably in VBA?

I need these to feed in to a different sheet to show how many goals each team have conceded, but I am struggling when 1 team has been played by both Teams 1 & 2.

I am hoping to end up with something like this, only automatic as the number of 'Teams' I am actually using is far far higher.

Team Name</SPAN>
Goals Conceded</SPAN>
Team 3</SPAN>
3</SPAN>
Team 4</SPAN>
2</SPAN>
Team 5</SPAN>
0</SPAN>
Team 6</SPAN>
3</SPAN>
Team 7</SPAN>
0</SPAN>
Team 8</SPAN>
4</SPAN>

<TBODY>
</TBODY>


The actual project I am working on has nothing to do with football but it is the same basic thing I am trying to achieve, so if someone could help with this I will hopefully be able to apply the lessons learnt here to my own problem as a resolution.

Thanks in advance!
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
Have your tried a pivot table with multiple consolidation ranges? It worked for me with your dample data:


Excel 2003
ABCDEFG
1Team 1Team 2
2Team PlayedGoals ScoredTeam PlayedGoals Scored
3Team 32Team 31Sum of ValueColumn
4Team 41Team 70RowGoals Scored
5Team 50Team 84Team 33
6Team 63Team 41Team 42
7Team 50
8Team 63
9Team 70
10Team 84
Sheet8
 
Upvote 0
Have your tried a pivot table with multiple consolidation ranges? It worked for me with your dample data:

Excel 2003
ABCDEFG
1Team 1Team 2
2Team PlayedGoals ScoredTeam PlayedGoals Scored
3Team 32Team 31Sum of ValueColumn
4Team 41Team 70RowGoals Scored
5Team 50Team 84Team 33
6Team 63Team 41Team 42
7Team 50
8Team 63
9Team 70
10Team 84

<COLGROUP><COL><COL><COL><COL><COL><COL><COL><COL></COLGROUP><THEAD>
</THEAD><TBODY>
</TBODY>
Sheet8


First and foremost thanks for the speedy response, this is exactly what I am looking for!

This may sound silly but I have never used a Pivot Table before in my life, so how precisely is this done, and can it be done in VBA? I am attempting to automate several processes, of which this is one, at the click of a button so using VBA to do this is pretty essential.

Thanks again, and thanks in advance for any further responses!
 
Upvote 0

Forum statistics

Threads
1,216,082
Messages
6,128,702
Members
449,464
Latest member
againofsoul

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