filtering/deleting rows

bradyj7

Board Regular
Joined
Mar 2, 2011
Messages
106
Hi there,

I have large sheets with time in column c and another variable, electricity being consumed in column d. In column d there are tens of rows of concentive zeros when people are not consuming electricty then when they plug in an item positive values occur. So there will be rows of zeros then rows of positive values then rows of zero agian when they plug out etc. However I am only interest in what time the person plugs in the item. So I only want to keep the row of the first positive value that occurs in each electricity consuming period.

Could some one help me out with a macro? I hope you can understand that.

thank you
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
Put this formula in E1
=D1>0

Put this formula in cell E2 (or any empty column) and copy it down the column for each cell in column D
=AND(D1=0,D2>0)

The formula will return TRUE only for the 1st positive values in column D after each zero.

Select column E
Select from the menu; Data\ Filter\ Autofilter
That will put a drop-down list in cell E1
Select from the E1 drop-down list "TRUE" to show only the rows with TRUE

You can then copy and paste the visible rows to a new sheet or do what you want to them.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,586
Messages
6,179,729
Members
452,939
Latest member
WCrawford

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