Home > database >  Excel How to get specific characters from different cells based on same value
Excel How to get specific characters from different cells based on same value

Time:06-20

I would like to know if it's possible to have some formula or VBA or other feature to get the specific characters from two or more different cells based on same value which grouped between the underscore. I am using this formula at the moment

=LEFT(A2,FIND("_",A2)-1)

on column B to get the characters from Column A. for example:

Current

Now what I want is something like this along with the comma:

Expected1

If it's not too much to ask already, is it also possible to add "&" to the cell, for example:

Expected2

if not than it's totally okay as this is only for aesthetic.

I hope it makes sense. Kindly let me know if it's possible. Thank you for your help in advance.

CodePudding user response:

I managed to get the answer from this Forum.

So basically create two helper column (Column A and B) and then input below formula by pressing CTRL SHIFT ENTER on other column (Column D).

=SUBSTITUTE(TEXTJOIN(", ",,A2,IF(($B$2:$B$10=B2)*($A$2:$A$10<>A2),$A$2:$A$10,"")),","," &",COUNTIFS($B$2:$B$10,B2)-1)

Answer

  • Related