Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 30
Default Complex text to Excel formatting. Urgent

Hi experts. I am totally lost with the question below:
I have a list of 1000 sites are continous in txt format where i need to
transfer the info in Excel format.
Info about each site starts by LST ALD: and ends by [---- end]

Now i need to transfer and extract info from the txt and put it in excel as
below:
Site No Device Name Scenario etc...
Site1 2100_R_U1 Regular
Site2 2100_R_U2 Regluar
etc....
------------------------------------------------------------------------------
LST ALD: OPMODE=CSAT;
A30042
+++ Site1
O&M #20062
Antenna Line Device Configure
-----------------------------
Device Name = UMTS2100_RET_U1
Scenario = REGULAR
Site No. = 0
---- end

LST ALD: OPMODE=CSAT;
B30042
+++ Site2
O&M #20062
Antenna Line Device Configure
-----------------------------
Device Name = UMTS2100_RET_U1
Scenario = REGULAR
Site No. = 0
---- end
etc......

If you have some tips do not hesitate to send .......thanks
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,805
Default Complex text to Excel formatting. Urgent

If you are familiar with VBA then
1. Paste the text file into an Excel sheet in Col A
2. In B1 enter =Trim(A1) and copy down
3. Select col B, Cut and PASTE Special|Values over Col A
4. Run the macro below
Sub convert()

Dim lastRow As Long
Dim i, j, loopCount, startAt, endAt As Integer

With ActiveSheet
lastRow = .Cells(.Rows.Count, "A").End(xlUp).Row + 1
End With

loopCount = lastRow / 11
For i = 1 To loopCount

j = 3 + (i - 1) * 11
startAt = 6
endAt = Len(Cells(j, 1))
Cells(i, 4) = Mid(Cells(j, 1), startAt, endAt)

j = j + 4
startAt = WorksheetFunction.Find("=", Cells(j, 1)) + 1
endAt = Len(Cells(j, 1))
Cells(i, 5) = Mid(Cells(j, 1), startAt, endAt)

j = j + 1
startAt = WorksheetFunction.Find("=", Cells(j, 1)) + 1
endAt = Len(Cells(j, 1))
Cells(i, 6) = Mid(Cells(j, 1), startAt, endAt)
Next
End Sub

5. If you have more fields to pick up then add to the macro above, as
appropirate

Assumption:
Each records has 11 rows in the txt file
You need to pick up row 3, 7 and 8
Value in row 3 starts after "+++" (at 5th position)
Value in row 7 and 8 starts after "="
Output is written on the same sheet starting at D1


"Teddy" wrote:

Hi experts. I am totally lost with the question below:
I have a list of 1000 sites are continous in txt format where i need to
transfer the info in Excel format.
Info about each site starts by LST ALD: and ends by [---- end]

Now i need to transfer and extract info from the txt and put it in excel as
below:
Site No Device Name Scenario etc...
Site1 2100_R_U1 Regular
Site2 2100_R_U2 Regluar
etc....
------------------------------------------------------------------------------
LST ALD: OPMODE=CSAT;
A30042
+++ Site1
O&M #20062
Antenna Line Device Configure
-----------------------------
Device Name = UMTS2100_RET_U1
Scenario = REGULAR
Site No. = 0
---- end

LST ALD: OPMODE=CSAT;
B30042
+++ Site2
O&M #20062
Antenna Line Device Configure
-----------------------------
Device Name = UMTS2100_RET_U1
Scenario = REGULAR
Site No. = 0
---- end
etc......

If you have some tips do not hesitate to send .......thanks

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,805
Default Complex text to Excel formatting. Urgent

If you are familiar with VBA then
1. Paste the text file into an Excel sheet in Col A
2. In B1 enter =Trim(A1) and copy down
3. Select col B, Cut and PASTE Special|Values over Col A
4. Run the macro below
Sub convert()

Dim lastRow As Long
Dim i, j, loopCount, startAt, endAt As Integer

With ActiveSheet
lastRow = .Cells(.Rows.Count, "A").End(xlUp).Row + 1
End With

loopCount = lastRow / 11
For i = 1 To loopCount

j = 3 + (i - 1) * 11
startAt = 6
endAt = Len(Cells(j, 1))
Cells(i, 4) = Mid(Cells(j, 1), startAt, endAt)

j = j + 4
startAt = WorksheetFunction.Find("=", Cells(j, 1)) + 1
endAt = Len(Cells(j, 1))
Cells(i, 5) = Mid(Cells(j, 1), startAt, endAt)

j = j + 1
startAt = WorksheetFunction.Find("=", Cells(j, 1)) + 1
endAt = Len(Cells(j, 1))
Cells(i, 6) = Mid(Cells(j, 1), startAt, endAt)
Next
End Sub

5. If you have more fields to pick up then add to the macro above, as
appropirate

Assumption:
Each records has 11 rows in the txt file
You need to pick up row 3, 7 and 8
Value in row 3 starts after "+++" (at 5th position)
Value in row 7 and 8 starts after "="
Output is written on the same sheet starting at D1


"Teddy" wrote:

Hi experts. I am totally lost with the question below:
I have a list of 1000 sites are continous in txt format where i need to
transfer the info in Excel format.
Info about each site starts by LST ALD: and ends by [---- end]

Now i need to transfer and extract info from the txt and put it in excel as
below:
Site No Device Name Scenario etc...
Site1 2100_R_U1 Regular
Site2 2100_R_U2 Regluar
etc....
------------------------------------------------------------------------------
LST ALD: OPMODE=CSAT;
A30042
+++ Site1
O&M #20062
Antenna Line Device Configure
-----------------------------
Device Name = UMTS2100_RET_U1
Scenario = REGULAR
Site No. = 0
---- end

LST ALD: OPMODE=CSAT;
B30042
+++ Site2
O&M #20062
Antenna Line Device Configure
-----------------------------
Device Name = UMTS2100_RET_U1
Scenario = REGULAR
Site No. = 0
---- end
etc......

If you have some tips do not hesitate to send .......thanks

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 30
Default Complex text to Excel formatting. Urgent

Hi Sheeloo, thanks for the help. Very encouraging and wanna learn more.
Another small question is that each record is not exactly even(11counts) .To
avoid unexpected cases might occur i was looking more to make a search
between LST ALD and End , search & extract values with parameter Device name
and Senario etc..wonder if it makes it more complicated?

"Sheeloo" wrote:

If you are familiar with VBA then
1. Paste the text file into an Excel sheet in Col A
2. In B1 enter =Trim(A1) and copy down
3. Select col B, Cut and PASTE Special|Values over Col A
4. Run the macro below
Sub convert()

Dim lastRow As Long
Dim i, j, loopCount, startAt, endAt As Integer

With ActiveSheet
lastRow = .Cells(.Rows.Count, "A").End(xlUp).Row + 1
End With

loopCount = lastRow / 11
For i = 1 To loopCount

j = 3 + (i - 1) * 11
startAt = 6
endAt = Len(Cells(j, 1))
Cells(i, 4) = Mid(Cells(j, 1), startAt, endAt)

j = j + 4
startAt = WorksheetFunction.Find("=", Cells(j, 1)) + 1
endAt = Len(Cells(j, 1))
Cells(i, 5) = Mid(Cells(j, 1), startAt, endAt)

j = j + 1
startAt = WorksheetFunction.Find("=", Cells(j, 1)) + 1
endAt = Len(Cells(j, 1))
Cells(i, 6) = Mid(Cells(j, 1), startAt, endAt)
Next
End Sub

5. If you have more fields to pick up then add to the macro above, as
appropirate

Assumption:
Each records has 11 rows in the txt file
You need to pick up row 3, 7 and 8
Value in row 3 starts after "+++" (at 5th position)
Value in row 7 and 8 starts after "="
Output is written on the same sheet starting at D1


"Teddy" wrote:

Hi experts. I am totally lost with the question below:
I have a list of 1000 sites are continous in txt format where i need to
transfer the info in Excel format.
Info about each site starts by LST ALD: and ends by [---- end]

Now i need to transfer and extract info from the txt and put it in excel as
below:
Site No Device Name Scenario etc...
Site1 2100_R_U1 Regular
Site2 2100_R_U2 Regluar
etc....
------------------------------------------------------------------------------
LST ALD: OPMODE=CSAT;
A30042
+++ Site1
O&M #20062
Antenna Line Device Configure
-----------------------------
Device Name = UMTS2100_RET_U1
Scenario = REGULAR
Site No. = 0
---- end

LST ALD: OPMODE=CSAT;
B30042
+++ Site2
O&M #20062
Antenna Line Device Configure
-----------------------------
Device Name = UMTS2100_RET_U1
Scenario = REGULAR
Site No. = 0
---- end
etc......

If you have some tips do not hesitate to send .......thanks

  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,805
Default Complex text to Excel formatting. Urgent

Yes, it can be done.

Let me know if you want me to do it. Also let me know which fields you want
to pick up and in which column...

If possible, send me the text file and Excel file in which you want the
output.

My id is to_sheeloo
add @hotmail.com to the id to get my email address.

WHat is your deadline?


"Teddy" wrote:

Hi Sheeloo, thanks for the help. Very encouraging and wanna learn more.
Another small question is that each record is not exactly even(11counts) .To
avoid unexpected cases might occur i was looking more to make a search
between LST ALD and End , search & extract values with parameter Device name
and Senario etc..wonder if it makes it more complicated?

"Sheeloo" wrote:

If you are familiar with VBA then
1. Paste the text file into an Excel sheet in Col A
2. In B1 enter =Trim(A1) and copy down
3. Select col B, Cut and PASTE Special|Values over Col A
4. Run the macro below
Sub convert()

Dim lastRow As Long
Dim i, j, loopCount, startAt, endAt As Integer

With ActiveSheet
lastRow = .Cells(.Rows.Count, "A").End(xlUp).Row + 1
End With

loopCount = lastRow / 11
For i = 1 To loopCount

j = 3 + (i - 1) * 11
startAt = 6
endAt = Len(Cells(j, 1))
Cells(i, 4) = Mid(Cells(j, 1), startAt, endAt)

j = j + 4
startAt = WorksheetFunction.Find("=", Cells(j, 1)) + 1
endAt = Len(Cells(j, 1))
Cells(i, 5) = Mid(Cells(j, 1), startAt, endAt)

j = j + 1
startAt = WorksheetFunction.Find("=", Cells(j, 1)) + 1
endAt = Len(Cells(j, 1))
Cells(i, 6) = Mid(Cells(j, 1), startAt, endAt)
Next
End Sub

5. If you have more fields to pick up then add to the macro above, as
appropirate

Assumption:
Each records has 11 rows in the txt file
You need to pick up row 3, 7 and 8
Value in row 3 starts after "+++" (at 5th position)
Value in row 7 and 8 starts after "="
Output is written on the same sheet starting at D1


"Teddy" wrote:

Hi experts. I am totally lost with the question below:
I have a list of 1000 sites are continous in txt format where i need to
transfer the info in Excel format.
Info about each site starts by LST ALD: and ends by [---- end]

Now i need to transfer and extract info from the txt and put it in excel as
below:
Site No Device Name Scenario etc...
Site1 2100_R_U1 Regular
Site2 2100_R_U2 Regluar
etc....
------------------------------------------------------------------------------
LST ALD: OPMODE=CSAT;
A30042
+++ Site1
O&M #20062
Antenna Line Device Configure
-----------------------------
Device Name = UMTS2100_RET_U1
Scenario = REGULAR
Site No. = 0
---- end

LST ALD: OPMODE=CSAT;
B30042
+++ Site2
O&M #20062
Antenna Line Device Configure
-----------------------------
Device Name = UMTS2100_RET_U1
Scenario = REGULAR
Site No. = 0
---- end
etc......

If you have some tips do not hesitate to send .......thanks

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
IME MODE FOR EXCEL 2007 (URGENT URGENT) Stella Wong Excel Discussion (Misc queries) 1 August 23rd 08 11:16 PM
Date Formatting in Excel Urgent KICI Excel Discussion (Misc queries) 1 April 21st 08 10:23 PM
Complex cond. formatting...Pls. Help! Roz Excel Discussion (Misc queries) 1 December 20th 05 07:52 PM
complex?? Q about Conditional formatting AngelaG Excel Worksheet Functions 0 August 18th 05 08:16 PM
*URGENT* - Complex formula needed Stacy Excel Discussion (Misc queries) 1 July 1st 05 05:32 PM


All times are GMT +1. The time now is 10:41 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"