Hello,
I need to generate output for drug_level for each subject_ID in the attached example XL2BB, such that the drug_level numbers are sorted based on the increasing number of days from the Day column. Also if there are more than one day with the same number, I want the drug levels to be averaged for that day. Also since the generated outputs will be used for graphing purposes, I want to exclude any blanks form the filtered outputs so that the chart lines don't collapse.
I have included an example for FILTER for subject A1 in cell G1, but I wasn't sure how to sort the numbers based on increasing days and how to average those days that have more than one number.
Also I have included examples for intended output in G5 and G9. They shows that some days with more than one number have averaged numbers and some days are skipped from output because there are no numbers for it.
Thanks for any input!
I need to generate output for drug_level for each subject_ID in the attached example XL2BB, such that the drug_level numbers are sorted based on the increasing number of days from the Day column. Also if there are more than one day with the same number, I want the drug levels to be averaged for that day. Also since the generated outputs will be used for graphing purposes, I want to exclude any blanks form the filtered outputs so that the chart lines don't collapse.
Book1 | |||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | |||
1 | Subject_ID | Day | Drug_level | Example FILTER: | A1 | 1000 | 500 | 654 | 732 | 1033 | 297 | 345 | 289 | 672 | 453 | ||||
2 | A1 | 7 | 1000 | ||||||||||||||||
3 | A1 | 5 | 500 | ||||||||||||||||
4 | A2 | 1 | 760 | day | 2 | 4 | 5 | 7 | 8 | 9 | |||||||||
5 | B3 | 3 | 892 | Intended output: | A1 | 558.33 | 289 | 467.5 | 1000 | 693 | 672 | ||||||||
6 | A1 | 8 | 654 | (avg.) | (avg.) | (avg.) | |||||||||||||
7 | A1 | 8 | 732 | ||||||||||||||||
8 | B2 | 4 | 612 | 2 | 3 | 4 | 6 | ||||||||||||
9 | C1 | 1 | 1024 | Intended output: | B2 | 453 | 1063.5 | 612 | 655 | ||||||||||
10 | A1 | 2 | 1033 | (avg.) | |||||||||||||||
11 | A1 | 2 | 297 | ||||||||||||||||
12 | A1 | 2 | 345 | ||||||||||||||||
13 | A1 | 4 | 289 | ||||||||||||||||
14 | D2 | 7 | 456 | ||||||||||||||||
15 | A1 | 3 | |||||||||||||||||
16 | A1 | 9 | 672 | ||||||||||||||||
17 | A1 | 5 | 453 | ||||||||||||||||
18 | A1 | 8 | |||||||||||||||||
19 | B2 | 2 | 453 | ||||||||||||||||
20 | C4 | 7 | 781 | ||||||||||||||||
21 | B2 | 3 | 1232 | ||||||||||||||||
22 | B2 | 3 | 895 | ||||||||||||||||
23 | C1 | 9 | 367 | ||||||||||||||||
24 | B2 | 6 | 655 | ||||||||||||||||
25 | B2 | 3 | |||||||||||||||||
26 | c1 | 7 | 652 | ||||||||||||||||
27 | |||||||||||||||||||
Sheet1 |
Cell Formulas | ||
---|---|---|
Range | Formula | |
G1:P1 | G1 | =TRANSPOSE(FILTER(C2:C18,(A2:A18=F1)*(C2:C18<>""))) |
Dynamic array formulas. |
I have included an example for FILTER for subject A1 in cell G1, but I wasn't sure how to sort the numbers based on increasing days and how to average those days that have more than one number.
Also I have included examples for intended output in G5 and G9. They shows that some days with more than one number have averaged numbers and some days are skipped from output because there are no numbers for it.
Thanks for any input!