HOW i can split data !

AhmedRady

New Member
Joined
May 22, 2019
Messages
20
Hello All,
i need to split the some data like :
Ahmed // ABC.com // call // 123456789
or
Ahmed // Abc.com // Mail // abc.com issue

and i need when ever the excel find that format *.com/*.net/*.edu put that data in product column and wherever find number put it in the number column
o know i should use split but i don't know how ????

to be
like that format :
[TABLE="class: grid, width: 500, align: center"]
<tbody>[TR]
[TD]name[/TD]
[TD]product[/TD]
[TD]contact way[/TD]
[TD]number[/TD]
[TD]subject[/TD]
[TD]issue[/TD]
[/TR]
[TR]
[TD]AHMED[/TD]
[TD]ABC.COM[/TD]
[TD]call[/TD]
[TD]123456789[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]ahmed[/TD]
[TD]abc.com[/TD]
[TD]mail[/TD]
[TD][/TD]
[TD]abc.com issue[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
 
kindly i need know to know how

A- i can add many rows as every time i write in Cell 3 the split data go to row 5 then 6 then 7 and so on

B-i can make 2 conditions :
1- if the cell A3 content number that number is start with "0" transfer to number column "column E"
2- if the Cell A3 content (( *.com or *.net )) that word transfer to product column "column B"

Sub SplitText1()

Const SourceRange = "A3" ' <-- Source data range, change to suit
Const DestCell = "a5" ' <-- First destination cell, change to suit

Dim a As Variant, Cell As Range, i As Long

For Each Cell In Range(SourceRange)
a = split(Cell.Value, "//")

ReDim Preserve a(0 To 6)
If Val(a(3)) = a(3) Then
a(4) = a(3)
a(3) = Empty
End If
Range(DestCell).Offset(i).Resize(, 6).Value = a
i = i + 1
Next



End Sub
 
Last edited:
Upvote 0

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
@Ahmed
FYI

Effective January 12, 2016, Internet Explorer 8 is no longer supported on any client or server version of Windows, due to new policies specifying that only the newest version of IE available for a supported version of Windows will be supported.

If you are running newer versions of Windows, it might be time to upgrade your browser.


 
Upvote 0
No , sir i used old version of Windows so that i can't upgrade my explorer

@Ahmed
FYI

Effective January 12, 2016, Internet Explorer 8 is no longer supported on any client or server version of Windows, due to new policies specifying that only the newest version of IE available for a supported version of Windows will be supported.

If you are running newer versions of Windows, it might be time to upgrade your browser.


 
Upvote 0
kindly i need know to know how

A- i can add many rows as every time i write in Cell 3 the split data go to row 5 then 6 then 7 and so on

B-i can make 2 conditions :
1- if the cell A3 content number that number is start with "0" transfer to number column "column E"
2- if the Cell A3 content (( *.com or *.net )) that word transfer to product column "column B"
Try this:
Rich (BB code):
Sub SplitText2()
 
  Dim a As Variant, b() As String, Part As Variant, LPart As String
  Dim i As Long, j As Long, k As Long
 
  ' Find row of the destination cell
  i = Columns("A").Cells.Find(What:="*", LookIn:=xlFormulas, SearchOrder:=xlByRows, _
                   SearchDirection:=xlPrevious, SearchFormat:=False).Row
  If i < 5 Then i = 5 Else i = i + 1
 
  ' Split data of A3 to array a()
  a = Split(Range("A3"), " // ")
 
  ' Prepare destination array
  ReDim b(0 To 5)
 
  ' Fill b()
  For j = 0 To UBound(a)
    Part = Trim(a(j))
    LPart = LCase(Part)
    If LPart Like "*.com" Or LPart Like "*.net" Then
      b(1) = Part ' Goes to column "B"
    ElseIf IsNumeric(LPart) And LPart Like "0*" Then
      If Not IsEmpty(b(4)) Then b(5) = b(4)
      b(4) = Part ' Goes to column "E"
    Else
      b(k) = Part
      k = k + 1
      If k = 1 Then k = 2
    End If
  Next
   
  ' Write b() to the dest range
  Range("A" & i).Resize(, 6).Value = b()
 
End Sub
Note: In post 1 the number is in D column not in E
 
Upvote 0

Forum statistics

Threads
1,223,636
Messages
6,173,484
Members
452,516
Latest member
archcalx

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