Lookup a list of values and return values in singe cell concatenated format

rstuart76

New Member
Joined
May 21, 2017
Messages
1
Hi - looking for a formula/code to lookup a range of values from a matched value and present them in a single cell concatenated format including range and comma separator:

There will sometimes be sequential values that can be ranged i.e. 100-106 but then there may be single values so needs to display i.e. 100-106, 110

DATA


[TABLE="width: 203"]
<tbody>[TR]
[TD]R/C[/TD]
[TD]A[/TD]
[TD]B[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]Name[/TD]
[TD]Code[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]Robby[/TD]
[TD]2234[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]Robby[/TD]
[TD]2235[/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]Robby[/TD]
[TD]2236[/TD]
[/TR]
[TR]
[TD]6[/TD]
[TD]Robby[/TD]
[TD]3455[/TD]
[/TR]
[TR]
[TD]7[/TD]
[TD]Dave[/TD]
[TD]9867[/TD]
[/TR]
[TR]
[TD]8[/TD]
[TD]Dave[/TD]
[TD]9868[/TD]
[/TR]
[TR]
[TD]9[/TD]
[TD]Dave[/TD]
[TD]3232[/TD]
[/TR]
[TR]
[TD]10[/TD]
[TD]Dave[/TD]
[TD]1112[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody><colgroup><col span="2"><col></colgroup>[/TABLE]
OUTPUT TO:

[TABLE="width: 334"]
<tbody>[TR]
[TD]Name[/TD]
[TD]Code Range[/TD]
[/TR]
[TR]
[TD]Robby[/TD]
[TD]2234-2236,3455[/TD]
[/TR]
[TR]
[TD]Dave[/TD]
[TD]9867-9868,3232,1112[/TD]
[/TR]
</tbody><colgroup><col span="2"></colgroup>[/TABLE]
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.

Forum statistics

Threads
1,224,823
Messages
6,181,170
Members
453,021
Latest member
Justyna P

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