Subtract Filtered Dates Only

Excel777

Well-known Member
Joined
Jul 3, 2009
Messages
912
Office Version
  1. 2019
Hi,

I want to subtract filtered cells ---each filtered cell from the previous filtered cell---

thanks in a

 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
If it was summing across, SUBTOTAL() would work.

I think only a macro solution is possible in your case.
Try this:
Code:
Sub SubFiltered()
lr = Cells(Rows.Count, "A").End(xlUp).Row 'last row in column A
prevdt = Cells(2, "A")
For r = 3 To lr
    If Not Rows(r).Hidden Then
        Cells(r, "B") = Cells(r, "A") - prevdt
        prevdt = Cells(r, "A")
    End If
Next r
End Sub
 
Upvote 0

Forum statistics

Threads
1,216,077
Messages
6,128,685
Members
449,463
Latest member
Jojomen56

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