Splitting Cell information and removing every other row

Butch-196

New Member
Joined
Sep 17, 2013
Messages
27
I have downloaded some information from an SD card and transferred it into excel. format is below in column A, however I would like the data to be split into separate cells as per columns B,C,D,E,F :-
ABCDEF
DayTimePump StatusLake Level
Time Stamp,2022072818,Pump on %,100,Level %,21,28/07/202218:00ON21%
Time Stamp,2022072819,Pump on %,0,Level %,22,28/07/202219:00ON21%
Time Stamp,2022072820,Pump on %,100,Level %,22,28/07/202220:00ON21%
Time Stamp,2022072821,Pump on %,0,Level %,21,28/07/202221:00ON21%
Time Stamp,2022072822,Pump on %,100,Level %,21,28/07/202222:00ON21%
Time Stamp,2022072823,Pump on %,0,Level %,21,28/07/202223:00ON21%
Time Stamp,2022072900,Pump on %,100,Level %,21,29/07/202200:00ON21%
Thanks for your help
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
Power Query is suitable for this.

Split Column --> By Delimiter --> choose Comma --> OK.

You can also filter out empty rows while you're in the query editor.
 
Upvote 0
try

VBA Code:
Dim WBook As Workbook
Dim Wsheet As Worksheet
Dim Ploop As Long
Dim Sloop As Long
Dim LastRow As Long
Dim ListArr() As String

Sub SplitData()
Set WBook = ThisWorkbook
Set Wsheet = WBook.ActiveSheet

LastRow = Range("A1").End(xlDown).Row

For Ploop = 1 To LastRow
    ListArr = Split(Wsheet.Range("A" & Ploop).Value, ",")
    Wsheet.Range("B" & Ploop).Value = ListArr
        For Sloop = LBound(ListArr) To UBound(ListArr)
            If Sloop > 0 Then
                Wsheet.Cells(Ploop, Sloop + 1).Value = ListArr(Sloop)
            End If
        Next Sloop
Next Ploop
End Sub
 
Upvote 0
Try:
VBA Code:
Sub SplitData()
    Application.ScreenUpdating = False
    Dim x As Long, v As Variant, lRow As Long
    lRow = Cells.Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
    For x = 2 To lRow Step 2
        v = Split(Range("A" & x), ",")
        Range("B" & x) = Format(DateSerial(Left(v(1), 4), Mid(v(1), 5, 2), Mid(v(1), 7, 2)), "dd/mm/yyyy")
        Range("C" & x) = Right(v(1), 2) & ":00"
        Range("D" & x) = UCase(Mid(v(2), 6, 2))
        Range("F" & x) = Left(v(5), 2) & "%"
    Next x
    Application.ScreenUpdating = True
End Sub
 
Upvote 0
try

VBA Code:
Dim WBook As Workbook
Dim Wsheet As Worksheet
Dim Ploop As Long
Dim Sloop As Long
Dim LastRow As Long
Dim ListArr() As String

Sub SplitData()
Set WBook = ThisWorkbook
Set Wsheet = WBook.ActiveSheet

LastRow = Range("A1").End(xlDown).Row

For Ploop = 1 To LastRow
    ListArr = Split(Wsheet.Range("A" & Ploop).Value, ",")
    Wsheet.Range("B" & Ploop).Value = ListArr
        For Sloop = LBound(ListArr) To UBound(ListArr)
            If Sloop > 0 Then
                Wsheet.Cells(Ploop, Sloop + 1).Value = ListArr(Sloop)
            End If
        Next Sloop
Next Ploop
End Sub
Need some help getting this to work. VBA is all still a little new - could you give me a formula?
 
Upvote 0
Have you tried the macro I suggested in Post #4?
 
Upvote 0
I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)

could you give me a formula?
Try these. I have assumed that pump status is either "on" or "off"

22 08 25.xlsm
ABCDEF
1DayTimePump StatusLake Level
2Time Stamp,2022072818,Pump on %,100,Level %,21,28/07/202218:00on21%
3Time Stamp,2022072819,Pump on %,0,Level %,22,28/07/202219:00on22%
4Time Stamp,2022072820,Pump on %,100,Level %,22,28/07/202220:00on22%
5Time Stamp,2022072821,Pump on %,0,Level %,21,28/07/202221:00on21%
6Time Stamp,2022072822,Pump off %,100,Level %,21,28/07/202222:00off21%
7Time Stamp,2022072823,Pump on %,0,Level %,21,28/07/202223:00on21%
8Time Stamp,2022072900,Pump on %,100,Level %,21,29/07/202200:00on21%
Split text
Cell Formulas
RangeFormula
B2:B8B2=DATE(MID(A2,12,4),MID(A2,16,2),MID(A2,18,2))
C2:C8C2=MID(A2,20,2)/24
D2:D8D2=TRIM(MID(A2,28,3))
F2:F8F2=RIGHT(SUBSTITUTE(A2,",",REPT(" ",10)),20)/100
 
Upvote 0

Forum statistics

Threads
1,224,828
Messages
6,181,209
Members
453,023
Latest member
alabaz

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