Dear All:
This is the sample spread sheet i have. pat meds stdt spdt 111 ABC 1 . 111 CDE 130 150 111 NNN 132 140 111 GHI 160 170 111 LMN 165 . 111 OPQ 168 . 222 ABC 1 . 222 CBM 130 140 222 AAA 135 140 222 KHA 1 . ; run; I am trying to count the number of meds at different time points and create three fields week 20,week 24 and diff based on the following. number of meds at week 20 = number of meds with no spdt and stdt = 1 + any meds between (127(stdt) to 154(spdt)) + any meds between (127(stdt) to 154(spdt)) and spdt = . number of meds at week 24 = number of meds with no spdt and stdt = 1 + any meds between (155(stdt) to 182(spdt)) + any meds between (155(stdt) to 182(spdt)) and spdt = . Ideally, this is what i am tring to get to ,one record per pat Pat week 20 week 24 diff(week 24-week 20) 111 3 4 1 222 4 2 -2 I hope i wasnt confusing .. Thanks in advance .. Al -- ---------------------------------------------------------------------------------- Some important links for excel users: 1. Follow us on TWITTER for tips tricks and links : http://twitter.com/exceldailytip 2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310 3. Excel tutorials at http://www.excel-macros.blogspot.com 4. Learn VBA Macros at http://www.quickvba.blogspot.com 5. Excel Tips and Tricks at http://exceldailytip.blogspot.com To post to this group, send email to excel-macros@googlegroups.com <><><><><><><><><><><><><><><><><><><><><><> HELP US GROW !! We reach over 7000 subscribers worldwide and receive many nice notes about the learning and support from the group.Let friends and co-workers know they can subscribe to group at http://groups.google.com/group/excel-macros/subscribe