extracting data from table

neilp

Well-known Member
Joined
Jul 5, 2004
Messages
529
Office Version
  1. 365
Platform
  1. Windows
Hi

I have a long series of data that contains names in column A, Products in column B and quantities in column C
eg:
<table>
<tr>
<th>A</th>
<th>B</th>
<th>C</th>
</tr>
<tr>
<td>John</td>
<td>Apples</td>
<td>7</td>
</tr>
<tr>
<td>Steve</td>
<td>Apples</td>
<td>4</td>
</tr>
<tr>
<td>Pete</td>
<td>Bananas</td>
<td>2</td>
</tr>
<tr>
<td>John</td>
<td>Melon</td>
<td>1</td>
</tr>
<tr>
<td>Pete</td>
<td>Apples</td>
<td>6</td>
</tr>
<tr>
<td>Dave</td>
<td>Bananas</td>
<td>3</td>
</tr>
</table>



I need to be able to move the quantites into a pre built table that has a list of the names down in 1 column and a list of the products across the top row.
eg
<table>
<tr>
<th>Name</th>
<th>Apples</th>
<th>Bananas</th>
<th>Melon</th>
</tr>
<tr>
<td>John</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>Steve</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>Pete</td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td>Dave</td>
<td></td>
<td></td>
<td></td>
</tr>
</table>


Anyone able to help?

thanks

Neil
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
using PowerQuery (Get&Transform)

Code:
[SIZE=1]let
    Source = Excel.CurrentWorkbook(){[Name="Table31"]}[Content],
    #"Pivoted Column" = Table.Pivot(Source, List.Distinct(Source[Fruit]), "Fruit", "Qty", List.Sum)
in
    #"Pivoted Column"[/SIZE]

NameFruitQtyNameApplesBananasMelon
JohnApples
7​
Dave
3​
SteveApples
4​
John
7​
1​
PeteBananas
2​
Pete
6​
2​
JohnMelon
1​
Steve
4​
PeteApples
6​
DaveBananas
3​
 
Upvote 0
Hi Sandy

Thanks for the reply, but you lost me at "PowerQuery".

How do i use that code?

thanks

Neil
 
Upvote 0
Hi, here is a formula option you could try.


Excel 2013/2016
ABCDEFGH
1JohnApples7NameApplesBananasMelon
2SteveApples4John701
3PeteBananas2Steve400
4JohnMelon1Pete620
5PeteApples6Dave030
6DaveBananas3
Sheet1
Cell Formulas
RangeFormula
F2=SUMIFS($C:$C,$A:$A,$E2,$B:$B,F$1)
 
Upvote 0

Forum statistics

Threads
1,213,487
Messages
6,113,943
Members
448,534
Latest member
benefuexx

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