+ Reply to Thread
Results 1 to 14 of 14

Need some help for 2 formulas for a Pivot Table re: Calculated Field

  1. #1
    Registered User
    Join Date
    07-06-2017
    Location
    Canada
    MS-Off Ver
    2013
    Posts
    20

    Need some help for 2 formulas for a Pivot Table re: Calculated Field

    Long story short I am working on an excel file and I have an assignment so I converted over the data to various pivot tables in order to answer some of the questions. The remaining questions are as follows:

    5. Average Length of Stay of these patients by CTAS (Registration to Time Pt Left ED)
    6. Percentage of CTAS 1-3 treated by Nurse Practitioner within 7 hours (Registration to Disposition (DISP))
    7. Percentage of CTAS 4-5 treated Nurse Practitioner within 4 hours (Registration to Disposition (DISP))

    With respect to question 5, I was able to create a pivot table but the answers I received (times formated in H:mm btw) in my pivot table (when I created a Calculated field) differ then when I manually averaged the numbers using the AVERAGE formula. Anyone know why they differ?

    With respect to questions 6 & 7, they are similar so I will discuss 6. In in my pivot table (when I created a Calculated field), I can't create a formula using the insert calculate field that will give me numbers similar to what I found when doing a manual calculation. I am looking for a formula that will provide me a count for those data ranges that are less than or equal to 7:00 (h:mm). I was able to do it manually but I can't do it via the Pivot Tables route.

    Can anybody please help??

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,455

    Re: Need some help for 2 formulas for a Pivot Table re: Calculated Field

    Welcome to the forum!

    Will you please attach a sample Excel workbook?

    1. Make sure that your sample data are REPRESENTATIVE of your real data. The use of unrepresentative data is very frustrating and can lead to long delays in reaching a solution.

    2. Make sure that your desired solution is also shown (mock up the results manually).

    3. Make sure that all confidential data is removed or replaced with dummy data first (e.g. names, addresses, E-mails, etc.).

    4. Try to avoid using merged cells as they cause lots of problems.

    Unfortunately the attachment icon doesn't work at the moment, so to attach an Excel file you have to do the following: just before posting, scroll down to Go Advanced and then scroll down to Manage Attachments. Now follow the instructions at the top of that screen.

    Please pay particular attention to point 2 (above): without an idea of your intended outcomes, it is often very difficult to offer appropriate advice.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Registered User
    Join Date
    07-06-2017
    Location
    Canada
    MS-Off Ver
    2013
    Posts
    20

    Re: Need some help for 2 formulas for a Pivot Table re: Calculated Field

    Ok - uploaded and thank you. I was going to put the specific formula's that I tried to use originally in this thread but when I did, I had an SQL error. Anyone know why?
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    07-06-2017
    Location
    Canada
    MS-Off Ver
    2013
    Posts
    20

    Re: Need some help for 2 formulas for a Pivot Table re: Calculated Field

    The tabs I am referring to that I need help with are the last 2 (Avg Length Stay by CTAS & %'age of CTAS 1-3 NPR's (7)). Regarding the formula's in the last tab, those were not the specific formula's I used rather I used them as templates being that I am relatively new to adding formula's into pivot tables

  5. #5
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,455

    Re: Need some help for 2 formulas for a Pivot Table re: Calculated Field

    If there are < or > symbols in the formula, put spaces either side of them and the forum should be happy. Still need to see the file, though, so thanks for that.

  6. #6
    Registered User
    Join Date
    07-06-2017
    Location
    Canada
    MS-Off Ver
    2013
    Posts
    20

    Re: Need some help for 2 formulas for a Pivot Table re: Calculated Field

    Okay AliGW - thank you very much. I entered spaces but still no luck

  7. #7
    Registered User
    Join Date
    07-06-2017
    Location
    Canada
    MS-Off Ver
    2013
    Posts
    20

    Re: Need some help for 2 formulas for a Pivot Table re: Calculated Field

    The blocked message I received when trying to post the formula:

    Block ID: SQLi17
    Block reason: SQL injection was detected and blocked.

  8. #8
    Registered User
    Join Date
    07-06-2017
    Location
    Canada
    MS-Off Ver
    2013
    Posts
    20

    Re: Need some help for 2 formulas for a Pivot Table re: Calculated Field

    With respect to question 5, I was able to create a pivot table but the answers I received (times formated in H:mm btw) in my pivot table (when I created a Calculated field) differ then when I manually averaged the numbers using the AVERAGE formula. The formula I inputed into the Formula field for the Insert Calculate Field was as follows "=AVERAGE('Dif between TIME PT LEFT and REG TIME' )" where 'TIME PT LEFT and REG TIME' in the input field I created and calculated the time difference between the 2 times (in 2 different columns) using =MOD(X2-I2,1) for example because some of the times overlap between 2 dates making a resulting column which is 'TIME PT LEFT and REG TIME' . Manually I figured out the averages by using the following formula (example) =AVERAGE('ED Data'!AH2:AH7). Anyone know why they differ?

  9. #9
    Registered User
    Join Date
    07-06-2017
    Location
    Canada
    MS-Off Ver
    2013
    Posts
    20

    Re: Need some help for 2 formulas for a Pivot Table re: Calculated Field

    With respect to questions 6 & 7, they are similar so I will discuss 6. In in my pivot table (when I created a Calculated field), I can't create a formula using the insert calculate field that will give me numbers similar to what I found when doing a manual calculation. I am looking for a formula that will provide me a count for those data ranges that are less than or equal to 7:00 (h:mm).

  10. #10
    Registered User
    Join Date
    07-06-2017
    Location
    Canada
    MS-Off Ver
    2013
    Posts
    20

    Re: Need some help for 2 formulas for a Pivot Table re: Calculated Field

    I was able to do it manually but I can't do it via the Pivot Tables route. Also for this I created an additional column that gives the difference between 'Registration to Disposition' times and was trying to insert into the Formula field in the Pivot Tables create a Calculate field.

  11. #11
    Registered User
    Join Date
    07-06-2017
    Location
    Canada
    MS-Off Ver
    2013
    Posts
    20

    Re: Need some help for 2 formulas for a Pivot Table re: Calculated Field

    The formulas I tried to use was to give a count to all those time ranges that were less then or equal to the 7:00 and to give a count (I tried using CountIF, Count and Frequency but to no avail).

  12. #12
    Registered User
    Join Date
    07-06-2017
    Location
    Canada
    MS-Off Ver
    2013
    Posts
    20

    Re: Need some help for 2 formulas for a Pivot Table re: Calculated Field

    The last CountIF formula I tried to use was similar to = COUNT(ROUND('Diff between Reg and Disp Time',1) < =TIMEVALUE(7)).

  13. #13
    Registered User
    Join Date
    07-06-2017
    Location
    Canada
    MS-Off Ver
    2013
    Posts
    20

    Re: Need some help for 2 formulas for a Pivot Table re: Calculated Field

    Wrt my last 5 posts, I had to break them up in order to post so I wouldn't get the block error message. The first one refers to question 5 and posts 2-5 refer to questions 6&7.

  14. #14
    Registered User
    Join Date
    02-16-2019
    Location
    canada
    MS-Off Ver
    excel
    Posts
    3

    Re: Need some help for 2 formulas for a Pivot Table re: Calculated Field

    Quote Originally Posted by KatMat232 View Post
    Long story short I am working on an excel file and I have an assignment so I converted over the data to various pivot tables in order to answer some of the questions. The remaining questions are as follows:

    5. Average Length of Stay of these patients by CTAS (Registration to Time Pt Left ED)
    6. Percentage of CTAS 1-3 treated by Nurse Practitioner within 7 hours (Registration to Disposition (DISP))
    7. Percentage of CTAS 4-5 treated Nurse Practitioner within 4 hours (Registration to Disposition (DISP))

    With respect to question 5, I was able to create a pivot table but the answers I received (times formated in H:mm btw) in my pivot table (when I created a Calculated field) differ then when I manually averaged the numbers using the AVERAGE formula. Anyone know why they differ?

    With respect to questions 6 & 7, they are similar so I will discuss 6. In in my pivot table (when I created a Calculated field), I can't create a formula using the insert calculate field that will give me numbers similar to what I found when doing a manual calculation. I am looking for a formula that will provide me a count for those data ranges that are less than or equal to 7:00 (h:mm). I was able to do it manually but I can't do it via the Pivot Tables route.

    Can anybody please help??
    Hi:
    I was wondering if you still have your caiculation. Thanks

+ 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. Pivot Table: Calculated Field based on Running Total Field
    By EvolvingMonkey in forum Excel Charting & Pivots
    Replies: 2
    Last Post: 09-07-2016, 06:27 AM
  2. Replies: 0
    Last Post: 08-15-2016, 02:07 PM
  3. [SOLVED] A pivot table field calculated using other field values as fields?
    By chrisf78 in forum Excel Charting & Pivots
    Replies: 5
    Last Post: 05-07-2015, 03:08 AM
  4. [SOLVED] Referring to a Sub-Field on Calculated Field Pivot Table Column?
    By figo12 in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 01-27-2014, 02:02 PM
  5. Replies: 0
    Last Post: 06-26-2012, 09:06 PM
  6. formulas for Calculated field in Pivot table
    By wt500 in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 02-28-2011, 06:12 AM
  7. [SOLVED] pivot table formulas for calculated field or calculated item
    By Vicky in forum Excel General
    Replies: 3
    Last Post: 06-06-2006, 12:10 AM

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