+ Reply to Thread
Results 1 to 4 of 4

Analyze subset of data in table

Hybrid View

  1. #1
    Registered User
    Join Date
    12-02-2010
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    32

    Analyze subset of data in table

    I have data as below. Patients can have several visits of various types. Some visit types may repeat (Initial Visit is the exception).

    ID	Visit	        VisitDate       Other Variables (not shown)
    ------------------------------------------------------------
    1	Initial Visit	1/1/2005
    1	Check-Up	2/2/2005
    1	Well-Being	3/10/2005
    1	Well-Being	7/7/2005
    1	Surgery	        9/1/2008
    ------------------------------------------------------------
    2	Initial Visit	2/3/2000
    2	Check-Up	5/1/2000
    2	Well-Being	3/1/2001
    ------------------------------------------------------------
    3	Initial Visit	7/1/2009
    3	Surgery 	4/1/2010
    I'm using Pivot Tables to analyze these data. How can I answer questions like:

    1. Among patients who had Well-Being visits, how many had a Surgery visit? [The answer is 2 patients had Well-Being visits, 1 of whom has had a Surgery visit.]

    2. What is the average number of days that passed between the Initial Visit and the Surgery Visit?

    To answer questions like these via the pivot, I suspect I need to restructure the data somehow, but I'm not entirely sure of the best way of even if that's necessary.

    Thank you for any suggestions.
    Attached Files Attached Files

  2. #2
    Forum Expert dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    Dubai, UAE
    MS-Off Ver
    1997 - 2016
    Posts
    8,191

    Re: Analyze subset of data in table

    Hi Holmes,

    you can achieve this using formulas as well, see the attachment:-

    pivotpost(2).xlsx

    Regards,
    DILIPandey
    <click on below * if this helps>
    DILIPandey, Excel rMVP
    +919810929744 (India), +971528225509 (Dubai), dilipandey@gmail.com

  3. #3
    Registered User
    Join Date
    12-02-2010
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    32

    Re: Analyze subset of data in table

    Quote Originally Posted by dilipandey View Post
    Hi Holmes,

    you can achieve this using formulas as well, see the attachment:-
    Thanks for this. Because I have other variables on which I may want to pivot the data (e.g., number of days between initial hx and surgery visit, by males vs. females), the formula approach may not be very scalable. I was hoping I could build into the pivot a calculated variable(s), which would automatically re-calculate based on the variables that are added to the pivot.

  4. #4
    Forum Expert dilipandey's Avatar
    Join Date
    12-05-2011
    Location
    Dubai, UAE
    MS-Off Ver
    1997 - 2016
    Posts
    8,191

    Re: Analyze subset of data in table

    Okay.. except last column, all other fields achieved using pivot, see attached:-


    pivotpost(2).xlsx

    for last field, "days passed", you can always drag down the formula


    Regards,
    DILIPandey
    <click on below * if this helps>

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1