+ Reply to Thread
Results 1 to 5 of 5

Need Macro program to create Pivot

  1. #1
    Forum Contributor
    Join Date
    10-02-2012
    Location
    india
    MS-Off Ver
    Excel 2010
    Posts
    165

    Need Macro program to create Pivot

    Hello Expert,
    I asked this question in this forum and one user suggest me to install software for solution which is not possible.

    Can anyone help me whether the solution can be made using Macro programming. Thank you very much in advance.

    My Query

    I want to create a pivot with list of patients based on specific country.
    From the country specific patient, I want to calculate patient with visit and patient without visit based on below principle

    --> Column "visit" having value >=1 is will be considered as single visit
    --> Column "visit" having value 0 or null will be considered as no visit

    Please check the attached excel sheet for reference
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,066

    Re: Need Macro program to create Pivot

    --> Column "visit" having value >=1 is will be considered as single visit
    --> Column "visit" having value 0 or null will be considered as no visit

    Can you detail with Pakistan for example
    Last edited by PCI; 06-13-2016 at 04:28 PM.
    - Battle without fear gives no glory - Just try

  3. #3
    Forum Contributor
    Join Date
    10-02-2012
    Location
    india
    MS-Off Ver
    Excel 2010
    Posts
    165

    Re: Need Macro program to create Pivot

    Thank you for looking into my query .

    My requirement is to create one pivot table in separate tab based on data available in sheet "HA".

    i)Count number of patients countrywise, to be populated in column "PID total". E.g. for Pakistan, PID total=5

    ii)Count number of patients which underwent visit to the clinic (that means value of visit >0) which should be populated in column "Visit with error"
    . e.g. For Pakistan, patient A002, A004 have gone for visit. so Visit with error=2

    iii) Count number of patients who have not gone any visit to the clinic (i.e. value of column visit =0), to be populated in column "Visit without error"
    e.g. For pakistan, patient A001, A003, A001 have not gone for any visit. so Visit without error=3

    iv) Last column "PCT of error free Visit" should calculate percentage of error free visit which means (visit without error/PID total)*100
    e.g. For pakistan, PCT of error free Visit= (3/5)*100=60%

    Please have a look into attached excel which I modified once again.

    Thanks in advance
    Attached Files Attached Files

  4. #4
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,066

    Re: Need Macro program to create Pivot

    See attached a poor possibility
    2 extra columns are added to help to the calculation
    Of course macros could be used to prepared calculation
    Note, that in your second file it is not possible to have merged cells for the header to be used with Pivot Table
    Attached Files Attached Files

  5. #5
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,066

    Re: Need Macro program to create Pivot

    Another way with macro
    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. How to create a dynamic macro that will create pivot table
    By thlee1122 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-08-2015, 11:49 PM
  2. Create a macro to create a pivot table in a worksheet
    By Triscia in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-15-2015, 10:53 AM
  3. [SOLVED] need to create a macro program for find:(
    By mariellove in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 10-04-2013, 09:31 AM
  4. Write a VB Macro to create a text data file for a dos program
    By rorw in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-27-2012, 10:18 AM
  5. Macro to create PDF from non-Adobe Program
    By SMB in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-14-2010, 11:52 AM
  6. How to create a Macro or function to execute a program
    By akadoggs in forum Excel General
    Replies: 1
    Last Post: 02-26-2008, 04:32 PM
  7. how do i make macro program on excell for create new txt file?
    By Richard in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-17-2006, 01:15 PM

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