#1   Report Post  
Kanga 85
 
Posts: n/a
Default Complex(?) Edit

I have a large spread sheet pasted from elsewhere. Lines alternate.

In Cell A1,A3,A5... I have text I want to keep.
In Cells A2, A4, A6... I have a string of numbers: eg
6.580 6.590 6.500 -0.010 5.950 ........
but they may be bigger or smaller than this: eg
12.250 12.310 12.300 0.040 .........
or 0.720 0.730 0.725 0.010 ......
I want to take the third one of these numbers (eg 6.500, or 12.300, or
0.725), paste it as a number into cell B. of the row above, and then delete
the row that this number originally came from. This needs to be done as a
subroutine through the whole spreadsheet.

The final result will be text in column A, a corresponding single number in
column B, and with only half the number of lines I originally started with.

Thanks for any help.
  #2   Report Post  
ww
 
Posts: n/a
Default

I think that "FIND()" will help you.
try this:=MID(A2,FIND(" ",A2,FIND(" ",A2)+1)+1,FIND(" ",A2,FIND("
",A2,FIND(" ",A2)+1)+1)-FIND(" ",A2,FIND(" ",A2)+1))

"Kanga 85" wrote:

I have a large spread sheet pasted from elsewhere. Lines alternate.

In Cell A1,A3,A5... I have text I want to keep.
In Cells A2, A4, A6... I have a string of numbers: eg
6.580 6.590 6.500 -0.010 5.950 ........
but they may be bigger or smaller than this: eg
12.250 12.310 12.300 0.040 .........
or 0.720 0.730 0.725 0.010 ......
I want to take the third one of these numbers (eg 6.500, or 12.300, or
0.725), paste it as a number into cell B. of the row above, and then delete
the row that this number originally came from. This needs to be done as a
subroutine through the whole spreadsheet.

The final result will be text in column A, a corresponding single number in
column B, and with only half the number of lines I originally started with.

Thanks for any help.

  #3   Report Post  
Rowan
 
Posts: n/a
Default

You could use a macro to do this eg

Sub CleanUp()

Dim spaceOne, spaceTwo, spaceThree As Integer
Dim getNum As Double

Range("A1").Select
Do Until ActiveCell.Value = Empty
If ActiveCell.Row Mod 2 = 0 Then
spaceOne = InStr(ActiveCell.Value, " ")
spaceTwo = InStr(spaceOne + 1, ActiveCell.Value, " ")
spaceThree = InStr(spaceTwo + 1, ActiveCell.Value, " ")
getNum = Mid(ActiveCell.Value, spaceTwo + 1, _
spaceThree - spaceTwo - 1)
ActiveCell.Offset(-1, 1).Value = getNum
End If
ActiveCell.Offset(1, 0).Select
Loop

ActiveCell.Offset(-1, 0).Select
Do Until ActiveCell.Row = 1
If ActiveCell.Row Mod 2 = 0 Then
ActiveCell.EntireRow.Delete
ActiveCell.Offset(-1, 0).Select
Else
ActiveCell.Offset(-1, 0).Select
End If
Loop

End Sub

Regards
Rowan

"Kanga 85" wrote:

I have a large spread sheet pasted from elsewhere. Lines alternate.

In Cell A1,A3,A5... I have text I want to keep.
In Cells A2, A4, A6... I have a string of numbers: eg
6.580 6.590 6.500 -0.010 5.950 ........
but they may be bigger or smaller than this: eg
12.250 12.310 12.300 0.040 .........
or 0.720 0.730 0.725 0.010 ......
I want to take the third one of these numbers (eg 6.500, or 12.300, or
0.725), paste it as a number into cell B. of the row above, and then delete
the row that this number originally came from. This needs to be done as a
subroutine through the whole spreadsheet.

The final result will be text in column A, a corresponding single number in
column B, and with only half the number of lines I originally started with.

Thanks for any help.

  #4   Report Post  
Kanga 85
 
Posts: n/a
Default

Thanks Rowan and ww. Looks exactly what I need.

"Rowan" wrote:

You could use a macro to do this eg

Sub CleanUp()

Dim spaceOne, spaceTwo, spaceThree As Integer
Dim getNum As Double

Range("A1").Select
Do Until ActiveCell.Value = Empty
If ActiveCell.Row Mod 2 = 0 Then
spaceOne = InStr(ActiveCell.Value, " ")
spaceTwo = InStr(spaceOne + 1, ActiveCell.Value, " ")
spaceThree = InStr(spaceTwo + 1, ActiveCell.Value, " ")
getNum = Mid(ActiveCell.Value, spaceTwo + 1, _
spaceThree - spaceTwo - 1)
ActiveCell.Offset(-1, 1).Value = getNum
End If
ActiveCell.Offset(1, 0).Select
Loop

ActiveCell.Offset(-1, 0).Select
Do Until ActiveCell.Row = 1
If ActiveCell.Row Mod 2 = 0 Then
ActiveCell.EntireRow.Delete
ActiveCell.Offset(-1, 0).Select
Else
ActiveCell.Offset(-1, 0).Select
End If
Loop

End Sub

Regards
Rowan

"Kanga 85" wrote:

I have a large spread sheet pasted from elsewhere. Lines alternate.

In Cell A1,A3,A5... I have text I want to keep.
In Cells A2, A4, A6... I have a string of numbers: eg
6.580 6.590 6.500 -0.010 5.950 ........
but they may be bigger or smaller than this: eg
12.250 12.310 12.300 0.040 .........
or 0.720 0.730 0.725 0.010 ......
I want to take the third one of these numbers (eg 6.500, or 12.300, or
0.725), paste it as a number into cell B. of the row above, and then delete
the row that this number originally came from. This needs to be done as a
subroutine through the whole spreadsheet.

The final result will be text in column A, a corresponding single number in
column B, and with only half the number of lines I originally started with.

Thanks for any help.

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
Customer Unable to Edit a Shared Workbook Lisa Excel Discussion (Misc queries) 0 February 17th 05 02:57 PM
Unable to Edit Shared Workbook Lisa Excel Discussion (Misc queries) 1 February 16th 05 10:31 PM
Can't edit comments foxcole Excel Discussion (Misc queries) 6 February 1st 05 10:37 PM
How to switch to edit the cell hon123456 Excel Discussion (Misc queries) 2 January 13th 05 10:40 AM
I can't edit excel by right clicking Jennie4 Excel Worksheet Functions 1 November 8th 04 10:52 PM


All times are GMT +1. The time now is 09:10 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"