Records and Rows If Statement Question / Help :)

colerainescotty

New Member
Joined
Feb 25, 2009
Messages
10
Hi folks, I have a simple excel spreadsheet that I am creating to get better at Excel and formulas for my IT course. I have a spreadsheet with some dummy data related to hospital procedures.

At the moment there are 6 doctors who carry out a procedure. The doctors in theory have to be audited and a report sheet produced. At the moment all of the data in a row relates to a particular doctor. There are various pieces of data I wish to collate for a particular doctor.

Firstly if possible I would like to be able to (for the report) say "Find all rows with Dr. A and calculate total dose of Drug A given to patients"


Here is an example of what I am trying to achieve

Excel Sheet

A B C D
1 Doctor Drug Dose
2 Dr. A 1mg
3 Dr. B 2mg
4 Dr. A 4mg

Is there a formula for me to be able to say in another "reporting" sheet (if row contains "Dr A" then total "drug dose")

If you need anymore information please do not hesitate to reply and I will be happy to answer.

Thanks so much in advance and I may have more questions soon :)
 
Sorry typo there. It should read 1.5 mg as the average dose. The criteria is the total mg administered divided by the no. of patients who received it. Patients not taking any medication are not taken into account.

Then for the percentage is just the no. of patients that were given any medication so 2 out of the 4 = 50%.

Hope this clarifies and thanks for the help. You certainly are an Excel genius :)
 
Upvote 0
I assumed you wanted the new calculations to be on "reporting" sheet as before:

Here's what I did:
Format "reporting" sheet Column "Average Dose mg" C2 down as "Number" to 2 decimal places.
Format "reporting" sheet Column "% Given" D2 down as "Percentage" to 2 decimal places.
Change the decimal places as you wish.

As before, I've use up to row # 400 for the formulas, use a higher number of rows than you anticipate you need.


Excel 2010
ABC
1DoctorPatient Drug Dose mg
2Dr. A1
3Dr. B2
4Dr. A4
5Dr. A0<- none
6Dr. A5
7Dr. C7
8Dr. C6
9Dr. C9
10Dr. C4
11Dr. Who3
12Dr. Who5
13Dr. A6
14Dr. C8
15Dr. Watson1
16Dr. Watson2
17Dr. Watson5
18Dr. A0<- none
19Dr. Who6
20Dr. B9
21Dr. Pepper7
22Dr. Pepper8
23Dr. A2
Sheet2



Excel 2010
ABCD
1DoctorTotal Drug Dose mgAverage Dose mg% Given
2Dr. A183.6020.00%
3Dr. B115.5050.00%
4Dr. C346.8020.00%
5Dr. Pepper157.5050.00%
6Dr. Watson82.6733.33%
7Dr. Who144.6733.33%
reporting
Cell Formulas
RangeFormula
B2=SUMIF(Sheet2!A$2:A$400,A2,Sheet2!B$2:B$400)
C2=AVERAGEIFS(Sheet2!B$2:B$400,Sheet2!A$2:A$400,A2,Sheet2!B$2:B$400,">0")
D2=C2/B2

Formulas copied down.
 
Upvote 0
Absolutely fantastic, exactly what I was needing :) I had to change the percentage a little though only to include the percentage of people seen who had been given the medication. I did this with countifs which I did not even know existed but your averageifs gave me the clue. Thanks very much I must say this is certainly teaching me stuff I never knew. I will let you know how I get on :)
 
Upvote 0
You're welcome.

I'm curious why you had to change the "% Given" formula, as I already excluded who did Not receive medication in the "Average Dose mg" formula.
So the simple "% Given" formula of =C2/B2 should show correct results.

What formula are you using exactly for "% Given", and are you getting different results?
 
Last edited:
Upvote 0
No problem, I had to use countifs to count the number of patients treated by a certain doctor. Then use the formula to get %. Eg as above Dr. A gave medication to roughly 71% of total patients rather than 20%. It may be likely that I didn't explain it very well and if so, apologies for that.

Just to confirm I worked out the total no. of patients treated by a doctor. Then worked out the number that received medication. Then divided it and formatted as percentage. I basically added another step of working out how many patients got medication. This is the formula to work out how many got the medication for a particular doctor =COUNTIFS('Patient Data'!E4:E30000,Operators!C5,'Patient Data'!O4:O30000,">0")

OperatorsC5 being Dr. A and Patient Data being sheet 2

Thanks again and sorry for my very bad explanations :)
 
Upvote 0
Ok, I understand now.

Once again, you're welcome, and it's great that you're learning new formulas and learning how and where to apply them, Great Job!
 
Upvote 0

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top