building a book index

yky

Well-known Member
Joined
Jun 7, 2011
Messages
1,881
Office Version
  1. 2010
Platform
  1. Windows
I have a sorted list with names in column A and page numbers in column B. I'd like to group the page numbers for the same person in the same cell. A person may have up to six pages. Any non-VBA method of doing it?

desired result
Jill2424
Joe1717
John5252, 99
John99
Steve5050, 66
Steve66
Tom5151, 88, 94
Tom88
Tom94
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
NamePageNameIndex
Jill24Jill24
Joe17Joe17
John52John52, 99
John99Steve50, 66
Steve50Tom51, 88, 94
Steve66
Tom51
Tom88
Tom94

Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    Group = Table.Group(Source, {"Name"}, {{"Count", each _, type table}}),
    List = Table.AddColumn(Group, "Index", each [Count][Page]),
    Extract = Table.TransformColumns(List, {"Index", each Text.Combine(List.Transform(_, Text.From), ", "), type text})
in
    Extract
Power Query add-in for XL2010/2013
 
  • Like
Reactions: yky
Upvote 0
Hi YKY,

Does this do it for you?

YKY.xlsx
ABCDEFGH
1NamePageP2P3P4P5P6Result
2Jill24     24
3Joe17     17
4John52, 99    52, 99
5John99      
6Steve50, 66    50, 66
7Steve66      
8Tom51, 88, 94   51, 88, 94
9Tom88      
10Tom94      
Sheet1
Cell Formulas
RangeFormula
C2:G10C2=IFERROR(IF(COUNTIF($A$2:$A2,$A2)<>1,"",", "&INDEX($B$2:$B$9999,AGGREGATE(15,6,ROW($A$2:$A$9999)-ROW($A$1)/($A$2:$A$9999=$A2),COLUMN()-COLUMN($A:$AA)))),"")
H2:H10H2=IF(COUNTIF($A$2:$A2,$A2)<>1,"",B2&C2&D2&E2&F2&G2)
 
  • Like
Reactions: yky
Upvote 0
Solution
NamePageNameIndex
Jill24Jill24
Joe17Joe17
John52John52, 99
John99Steve50, 66
Steve50Tom51, 88, 94
Steve66
Tom51
Tom88
Tom94

Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    Group = Table.Group(Source, {"Name"}, {{"Count", each _, type table}}),
    List = Table.AddColumn(Group, "Index", each [Count][Page]),
    Extract = Table.TransformColumns(List, {"Index", each Text.Combine(List.Transform(_, Text.From), ", "), type text})
in
    Extract
Power Query add-in for XL2010/2013
Thank you. Power query has been on my to-learn list for quite a while. It has now become the top priority.
 
Upvote 0
Hi YKY,

Does this do it for you?

YKY.xlsx
ABCDEFGH
1NamePageP2P3P4P5P6Result
2Jill24     24
3Joe17     17
4John52, 99    52, 99
5John99      
6Steve50, 66    50, 66
7Steve66      
8Tom51, 88, 94   51, 88, 94
9Tom88      
10Tom94      
Sheet1
Cell Formulas
RangeFormula
C2:G10C2=IFERROR(IF(COUNTIF($A$2:$A2,$A2)<>1,"",", "&INDEX($B$2:$B$9999,AGGREGATE(15,6,ROW($A$2:$A$9999)-ROW($A$1)/($A$2:$A$9999=$A2),COLUMN()-COLUMN($A:$AA)))),"")
H2:H10H2=IF(COUNTIF($A$2:$A2,$A2)<>1,"",B2&C2&D2&E2&F2&G2)
Thank you. Works like a charm.
 
Upvote 0

Forum statistics

Threads
1,214,921
Messages
6,122,280
Members
449,075
Latest member
staticfluids

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