ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   New Users to Excel (https://www.excelbanter.com/new-users-excel/)
-   -   Filter in between dates (https://www.excelbanter.com/new-users-excel/247166-filter-between-dates.html)

Linda RQ

Filter in between dates
 
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



Don Guillett

Filter in between dates
 
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

"Linda RQ" wrote in message
...
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



Linda RQ

Filter in between dates
 
Sent....thanks


"Don Guillett" wrote in message
...
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

"Linda RQ" wrote in message
...
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





Don Guillett

Filter in between dates
 
Didn't get to me

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Linda RQ" wrote in message
...
Sent....thanks


"Don Guillett" wrote in message
...
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

"Linda RQ" wrote in message
...
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






Linda RQ

Filter in between dates
 
Just tried again....Linda


"Don Guillett" wrote in message
...
Didn't get to me

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Linda RQ" wrote in message
...
Sent....thanks


"Don Guillett" wrote in message
...
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

"Linda RQ" wrote in message
...
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








Don Guillett

Filter in between dates
 
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


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Linda RQ" wrote in message
...
Just tried again....Linda


"Don Guillett" wrote in message
...
Didn't get to me

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Linda RQ" wrote in message
...
Sent....thanks


"Don Guillett" wrote in message
...
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

"Linda RQ" wrote in message
...
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









Linda RQ

Filter in between dates
 
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

"Don Guillett" wrote in message
...
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


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Linda RQ" wrote in message
...
Just tried again....Linda


"Don Guillett" wrote in message
...
Didn't get to me

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Linda RQ" wrote in message
...
Sent....thanks


"Don Guillett" wrote in message
...
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

"Linda RQ" wrote in message
...
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












All times are GMT +1. The time now is 07:24 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com