ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Splitting the characters in the cell (https://www.excelbanter.com/excel-worksheet-functions/173207-splitting-characters-cell.html)

Christopher Naveen[_2_]

Splitting the characters in the cell
 
Hi

I have a cell which contains 300+ of email ID's seperated by commas, Pls
refer the example as shown below

A1
, , , , ,
, , , ..........

Now i want to split the email ID's seperately as show below,

A1
,
A2
,
A3
,
A4
, like this. Can anyone help me how to do this in excel.

Also I want to know the cell contains 300+ email ID's which cannot be
spilted in the cols as excel permits max of 256 cells in cols wher i have
300+ email ID's. if i want to split the email ID's in row how can i do that?

Eagerly Waiting for ur reply.

Thanks in Advance!!!!!

-Christ.





ShaneDevenshire

Splitting the characters in the cell
 
Hi,

Select the cell and choose Data, Text to Columns, Delimited, Next, set the
delimiter to , (comma) and click finish. If there are more than 256 entries
this may cause a problem if you are running 2003 or earlier.
Highlight all the columns with addresses and choose copy, click an empty
cell and choose Edit, Paste Special, Transpose.

If there are really 300+ items highlight about half of them on the formula
bar and copy and paste those to a separate cell. The do the above steps
twice.

--
Cheers,
Shane Devenshire


"Christopher Naveen" wrote:

Hi

I have a cell which contains 300+ of email ID's seperated by commas, Pls
refer the example as shown below

A1
, , , , ,
, , , ..........

Now i want to split the email ID's seperately as show below,

A1
,
A2
,
A3
,
A4
, like this. Can anyone help me how to do this in excel.

Also I want to know the cell contains 300+ email ID's which cannot be
spilted in the cols as excel permits max of 256 cells in cols wher i have
300+ email ID's. if i want to split the email ID's in row how can i do that?

Eagerly Waiting for ur reply.

Thanks in Advance!!!!!

-Christ.





Christopher Naveen[_2_]

Splitting the characters in the cell
 
Hi Shane,

Great!!!! Its working fine. Thanks a lot for ur quick response.

I want to know do we have any formula to check a few characters in cell and
calculate the value?

Ex :

I have a col and it contains some charatcers i want to check for a
particular character in a cell and if it is true i want to return some value
in the next col.

A1 B1
abc if(A1 contains "L", "YES", "NO")
cde if(A2 contains "L", "YES", "NO")
efg if(A3 contains "L", "YES", "NO")
ghi ...........
KJL ...........
MLM ...........
NLP ...........
OPP ...........
LLO ...........

Can u pls check and let me know how can we calculate this?.

Thanks !!!!!!!

-Chrsit


"ShaneDevenshire" wrote:

Hi,

Select the cell and choose Data, Text to Columns, Delimited, Next, set the
delimiter to , (comma) and click finish. If there are more than 256 entries
this may cause a problem if you are running 2003 or earlier.
Highlight all the columns with addresses and choose copy, click an empty
cell and choose Edit, Paste Special, Transpose.

If there are really 300+ items highlight about half of them on the formula
bar and copy and paste those to a separate cell. The do the above steps
twice.

--
Cheers,
Shane Devenshire


"Christopher Naveen" wrote:

Hi

I have a cell which contains 300+ of email ID's seperated by commas, Pls
refer the example as shown below

A1
, , , , ,
, , , ..........

Now i want to split the email ID's seperately as show below,

A1
,
A2
,
A3
,
A4
, like this. Can anyone help me how to do this in excel.

Also I want to know the cell contains 300+ email ID's which cannot be
spilted in the cols as excel permits max of 256 cells in cols wher i have
300+ email ID's. if i want to split the email ID's in row how can i do that?

Eagerly Waiting for ur reply.

Thanks in Advance!!!!!

-Christ.





Ron Rosenfeld

Splitting the characters in the cell
 
On Tue, 15 Jan 2008 22:30:01 -0800, Christopher Naveen
wrote:

Hi

I have a cell which contains 300+ of email ID's seperated by commas, Pls
refer the example as shown below

A1
, , , , ,
,
, , ..........

Now i want to split the email ID's seperately as show below,

A1
,
A2
,
A3
,
A4
, like this. Can anyone help me how to do this in excel.

Also I want to know the cell contains 300+ email ID's which cannot be
spilted in the cols as excel permits max of 256 cells in cols wher i have
300+ email ID's. if i want to split the email ID's in row how can i do that?

Eagerly Waiting for ur reply.

Thanks in Advance!!!!!

-Christ.




You could use this VBA Macro to split the cell into rows. I started with A2,
so as to preserve your original data, but it could be modified to wipe out the
original entry.

To enter this, <alt-F11 opens the VB Editor. Ensure your project is
highlighted in the Project Explorer window, then Insert/Module and paste the
code below into the window that opens.

To use it, select the cell(s) you wish to split on comma. <alt-F8 opens the
macro dialog box, RUN the macro.

===========================================
Option Explicit
Sub SplitToRows()
Const Comma As String = ","
Dim c As Range
Dim i As Long
Dim sSplitArray() As String

For Each c In Selection
sSplitArray = Split(c.Value, Comma)

For i = 0 To UBound(sSplitArray)
c(i + 2, 1).Value = Replace(Trim(sSplitArray(i)), vbLf, "")
Next i
Next c
End Sub
=============================================

To split to columns, with some maximum number of columns, you can try this
macro:

==========================================
Sub SplitToColumns()
Const MaxCols As Long = 256 'set this to whatever or use inputbox
Const Comma As String = ","
Dim c As Range
Dim i As Long
Dim sSplitArray() As String

For Each c In Selection
sSplitArray = Split(c.Value, Comma)

For i = 0 To UBound(sSplitArray)
c(1 + Int(i / MaxCols), 2 + i Mod MaxCols).Value =
Replace(Trim(sSplitArray(i)), vbLf, "")
Next i
Next c
End Sub
=============================================
--ron

Ron Rosenfeld

Splitting the characters in the cell
 


To split to columns, with some maximum number of columns, you can try this
macro:

==========================================
Sub SplitToColumns()
Const MaxCols As Long = 256 'set this to whatever or use inputbox
Const Comma As String = ","
Dim c As Range
Dim i As Long
Dim sSplitArray() As String

For Each c In Selection
sSplitArray = Split(c.Value, Comma)

For i = 0 To UBound(sSplitArray)
c(1 + Int(i / MaxCols), 2 + i Mod MaxCols).Value =
Replace(Trim(sSplitArray(i)), vbLf, "")
Next i
Next c
End Sub
=============================================
--ron


I noticed my newsreader wrapped a line in this second macro in the wrong spot.
So as to prevent that, I forced a line break appropriately:

=============================================
Sub SplitToColumns()
Const MaxCols As Long = 3 'set this to whatever or use inputbox
Const Comma As String = ","
Dim c As Range
Dim i As Long
Dim sSplitArray() As String

For Each c In Selection
sSplitArray = Split(c.Value, Comma)

For i = 0 To UBound(sSplitArray)
c(1 + Int(i / MaxCols), 2 + i Mod MaxCols).Value = _
Replace(Trim(sSplitArray(i)), vbLf, "")
Next i
Next c
End Sub
===========================================
--ron


All times are GMT +1. The time now is 07:09 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com