Help to get characters from different cells based on same character

gargilang

New Member
Joined
Jun 17, 2022
Messages
19
Office Version
  1. 365
Platform
  1. Windows
Hello, I would like to know if it's possible to have some formula to get the specific characters from two or three different cells based on same character in it. I am using this formula at the moment
Excel Formula:
=LEFT(A2,FIND("_",A2)-1)
to get the characters I want. for example below table:
1_aaaa_x1
2_aaaa_y2
3_bbbb_x3

Now what I want is something like this:
1_aaaa_x1, 2
2_aaaa_y2, 1
3_bbbb_x3, 4, 5
4_bbbb_y4, 3, 5
5_bbbb_z5, 3, 4

And now if it's not too much to ask already, is it also possible to have the formula to add "&" to the cell, for example:
1_aaaa_x1 & 2
2_aaaa_y2 & 1
3_bbbb_x3, 4 & 5
4_bbbb_y4, 3 & 5
5_bbbb_z5, 3 & 4
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.
 
Ok, try
Excel Formula:
=SUBSTITUTE(TEXTJOIN(", ",,A2,IF(($B$2:$B$10=B2)*($A$2:$A$10<>A2),$A$2:$A$10,"")),","," &",MAX(1,COUNTIFS($B$2:$B$10,B2)-1))
 
Upvote 0
Solution

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
Ok, try
Excel Formula:
=SUBSTITUTE(TEXTJOIN(", ",,A2,IF(($B$2:$B$10=B2)*($A$2:$A$10<>A2),$A$2:$A$10,"")),","," &",MAX(1,COUNTIFS($B$2:$B$10,B2)-1))
This is it! Thank you so ever very much! Once again... 🙇‍♂️
 

Attachments

  • Screenshot 2022-06-17 162725.jpg
    Screenshot 2022-06-17 162725.jpg
    150.9 KB · Views: 7
Upvote 0
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,184
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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