Extract Data

blandmido

New Member
Joined
Mar 5, 2014
Messages
10
Hi
I have large number of rainfall data, the system record values on daily basis, so most of the records are zero values, I want to an easy extract the rainfall daily data greater than 0 , part of the data is attached below.
Thank you

STATION_NUMBERYEARMONTHDAYRAINFALL_TOTAL
404301985110
404301985120
404301985130
404301985140
404301985150
404301985160
404301985170
404301985180
404301985190
4043019851100
4043019851110
4043019851120
4043019851130
4043019851140
4043019851150
4043019851160
4043019851170
4043019851180
4043019851190
4043019851200
4043019851210
4043019851220
4043019851230
4043019851242.7
4043019851250.5
4043019851260
4043019851270
4043019851286.6

<colgroup><col span="4"><col></colgroup><tbody>
</tbody>
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
Why not select the Rainfall Total column, apply AutoFilter to it and use "Does not equal" 0 as the filter... you can then copy/paste the visible rows to wherever you want.
 
Upvote 0
If you want a macro to do this we need the following information.
1. Where are we going to extract this data to.
2. Is the current data in Columns “A” “B”….
3. If you want this extracted to another sheet then we need the name of the data sheet and the extract to sheet.
 
Upvote 0
Why not select the Rainfall Total column, apply AutoFilter to it and use "Does not equal" 0 as the filter... you can then copy/paste the visible rows to wherever you want.

Thank you very much Rick, I didn't think of this simple and straightforward solution, and it works perfectly
 
Upvote 0
If you want a macro to do this we need the following information.
1. Where are we going to extract this data to.
2. Is the current data in Columns “A” “B”….
3. If you want this extracted to another sheet then we need the name of the data sheet and the extract to sheet.

Thank you "My answer is This", I am interested in the last column, E, I think its better to be extracted in a new shhet, names can be anything, for example: "Rainfall total" for original data sheet and "Values" for the extracted data sheet
 
Upvote 0
Blandmido
Try this:
I have set this up as per your request.
The sheet with your data must be named “Rainfall total”
The sheet we will be copying data to must be named “Values”
This script should do what you asked. If you have problems check back here with me.
You can modify the sheet names but if you do just be sure and change the places in the script where the sheet name is referred to.
Code:
Sub Rain_Fall_Data()
Application.ScreenUpdating = False
Dim i As Integer
Dim Lastrow As Long
Dim Lastrow2 As Long
Sheets("[COLOR="#FF0000"]Rainfall total[/COLOR]").Activate
'You can change this sheet name if you like then just change your sheet name
Lastrow = Cells(Rows.Count, "E").End(xlUp).Row
Lastrow2 = Sheets("[COLOR="#FF0000"]Values[/COLOR]").Cells(Rows.Count, "E").End(xlUp).Row + 1
    For i = 1 To Lastrow
        If Cells(i, 5).Value > 0 Then
            Sheets("[COLOR="#FF0000"]Values[/COLOR]").Rows(Lastrow2).Value = Rows(i).Value
            Lastrow2 = Lastrow2 + 1
        End If
    Next
Application.ScreenUpdating = True

End Sub
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,653
Messages
6,120,750
Members
448,989
Latest member
mariah3

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