VBA - Multiple values in a cell (comma separated) and return the corresponding values to a single cell (comma separated) with characters more than 255

Hari1992

New Member
Joined
May 7, 2021
Messages
11
Office Version
  1. 2019
  2. 2016
Platform
  1. Windows
Hi,

I am looking for a VBS/ formula for the following. Here I am trying to achieve Dynamic Lookup for multiple values in a cell (comma separated) and return the corresponding values to a single cell (comma separated also). I am able to populate the B13 through the formula with Barnames column which has less than 255 char, but not working for B14 which has more than 255 char. Could someone suggest to me the Formula/Macro/VBS achieve this?

Thanks in advance,

1620751230587.png



Cell Formulas

B4- =REPT("-",255)

C4- =REPT("-",255)

B13- =TEXTJOIN(CHAR(10),1,IF(ISNUMBER(FIND(","&$A$4:$A$7&",",","&A13&",")),$B$4:$B$7,""))

B14- =TEXTJOIN(CHAR(10),1,IF(ISNUMBER(FIND(","&$A$4:$A$7&",",","&A14&",")),$C$4:$C$7,""))
 

Attachments

  • 1620751357494.png
    1620751357494.png
    15.9 KB · Views: 19

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
Well, that's the issue...there's a character limit in a cell to 255 characters. There's probably some CONCATENATE work-around, but I don't know it.
 
Upvote 0
The character limit for a cell is ~32,700 for a string, the problem is that that the IF function is limited to 255 characters/cell.
 
Upvote 0

Awesome!! you are the savior :)

It worked. I have another question.....What if I want to add 2 lines of space between. Here Char(10) would give me 1 line. I am looking for a two-line or Three-line space for a clear view. Please suggest
 
Upvote 0
Just add another line feed like CHAR(10)&CHAR(10)
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,175
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