Regrouping values of multiple cells according to variable data

DavidVeilleux

New Member
Joined
Apr 15, 2017
Messages
3
Hi, I am trying to automate a very long process with excel. I work in a motorsport business and I would like to do application charts automatically in excel. Let's say, a bearing fits on a XXXX 4-wheeler from 1996 to 1998, 2000 and 2002 to 2005. I want to have this written this way : 92-98, 00, 02-05. My data is presented as a list:

Model Year
XXXX 1996
XXXX 1997
XXXX 1998
XXXX 2000
XXXX 2002
XXXX 2003
XXXX 2004
XXXX 2005
YYYY 1999
YYYY 2001
YYYY 2002

N.B. There is always more than one model in the list.

Presently I make a pivot table out of the data and I'm trying to have a formula per row

Years
Models 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 Result
XXXX 1 1 1 1 1 1 1 1 96-98, 00, 02-05
YYYY 1 1 1 99, 01-02

My formula I presently use is this one, but it is static as my ranges were manually typed in but they change on every line (highlighted in yellow).

=CONCATENATE(RIGHT(INDIRECT(ADDRESS(1;MATCH("X";2:2;0)));2);"-";RIGHT(INDIRECT(ADDRESS(1;MATCH("Y";AT2:BZ2;0)+MATCH("X";2:2;0)-2));2);", ";RIGHT(INDIRECT(ADDRESS(1;MATCH("X";AX2:BZ2;0)+MATCH("Y";AT2:BZ2;0)+MATCH("X";2:2;0)-2));2);"-";RIGHT(INDIRECT(ADDRESS(1;MATCH("y";BD2:BZ2;0)+MATCH("X";AX2:BZ2;0)+MATCH("Y";AT2:BZ2;0)+MATCH("X";2:2;0)-4));2))

Maybe I'm going at it wrong, so don't hesitate to use a completely different method.
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.

Forum statistics

Threads
1,214,575
Messages
6,120,334
Members
448,956
Latest member
Adamsxl

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