Filter in between dates

L

Linda RQ

Hi Everyone,

Using Excel 2003. I have a list of patients who were on a particular
therapy and in a certain unit. Many where on the therapy in other units
before getting transferred or on the therapy after they left. I need to
find the patients who started on a therapy after they arrived in a unit and
who were off the therapy before they left the unit. My Date units show me
Date and Time in the same field. They are named..

PtLocStDtTm
PtLocEndDtTm
PtThpyStDtTm
PtThpyEndDtTm

Thanks,
Linda
 
D

Don Guillett

If desired, send your file to my address below. I will only look if:
1. You send a copy of this message on an inserted sheet
2. You give me the newsgroup and the subject line
3. You send a clear explanation of what you want
4. You send before/after examples and expected results.
 
L

Linda RQ

Sent....thanks


Don Guillett said:
If desired, send your file to my address below. I will only look if:
1. You send a copy of this message on an inserted sheet
2. You give me the newsgroup and the subject line
3. You send a clear explanation of what you want
4. You send before/after examples and expected results.


--
Don Guillett
Microsoft MVP Excel
SalesAid Software
(e-mail address removed)
 
D

Don Guillett

This should do it. File returned to OP

Sub GetReportSAS()
Application.ScreenUpdating = False
Dim dlr As Long
Dim i As Long
Dim ss As Worksheet

Set ss = Sheets("Report")
dlr = ss.Cells(Rows.Count, 1).End(xlUp).Row
ss.Rows(9).Resize(dlr - 8).Delete

With Sheets("Data")
For i = 9 To .Cells(Rows.Count, 1).End(xlUp).Row
dlr = ss.Cells(Rows.Count, 1).End(xlUp).Row + 1
If Not .Cells(i, "h") < .Cells(i, "g") And _
Not .Cells(i, "j") > .Cells(i, "I") Then _
.Rows(i).Copy ss.Cells(dlr, 1)
Next i
End With
Application.ScreenUpdating = True
End Sub
 
L

Linda RQ

Thanks Don! Gee, I think that is VB code but didn't realize it could be
used in excel and I don't know what the heck it says but the first 100
records of your report matches my hand done version so I guess I am done
with this part of the project. I was hoping it was something I could learn
to do but I don't think so yet.

Thanks,
Linda
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top