感谢您的帮助!没有辅助列/行,我试图找出患者第一次和最后一次就诊时LVEDi的平均差异。
例如,您可以手工完成:
(diff for patient a + diff for pt b + diff for pt c)/3 =
((55-45) + (40-31) + (25-31))/3 =
(10 + 9 + (-6))/3 =
13/3 =
4.333
我确定答案涉及使用数组函数进行索引,但我无法开始解决它的问题!
任何帮助?
谢谢!
A | B | C | D | E
01 Patient ID | Date | First-Last | LVEDi | LOTS of similar cols
02 a | 3/3/03 | LAST | 55
03 a | 1/1/01 | FIRST | 45
04 a | 2/2/02 | | 65
05 b | | |
06 b | 3/2/16 | LAST | 40
07 b | | |
08 b | | |
09 b | 2/1/12 | FIRST | 31
10 c | 1/7/14 | LAST | 25
11 c | | |
12 c | 2/2/03 | FIRST | 31
13 c | 2/2/08 | | 46
答案 0 :(得分:1)
您可以在数组中使用*
as和AND
条件,因此使用MATCH
搜索实例,其中两个条件相乘均为TRUE
(即{{ 1}})。其余的只是填写你的计算:
1
请记得使用{=((INDEX(D2:D13,MATCH(1,(A2:A13="a")*(C2:C13="LAST"),0))-INDEX(D2:D13,MATCH(1,(A2:A13="a")*(C2:C13="FIRST"),0)))+(INDEX(D2:D13,MATCH(1,(A2:A13="b")*(C2:C13="LAST"),0))-INDEX(D2:D13,MATCH(1,(A2:A13="b")*(C2:C13="FIRST"),0)))+(INDEX(D2:D13,MATCH(1,(A2:A13="c")*(C2:C13="LAST"),0))-INDEX(D2:D13,MATCH(1,(A2:A13="c")*(C2:C13="FIRST"),0))))/3}
+ CTRL
+ SHIFT
输入数组。
答案 1 :(得分:1)
找到一个稍微冗长的方法:
query = """
SELECT catalog_product_entity.sku
FROM catalog_product_entity
INNER JOIN catalog_product_entity_decimal ON catalog_product_entity_decimal.entity_id = catalog_product_entity.entity_id
INNER JOIN catalog_product_entity_int ON catalog_product_entity_int.entity_id = catalog_product_entity.entity_id
WHERE catalog_product_entity.sku IS NOT NULL
AND catalog_product_entity_int.attribute_id = '84'
"""
编辑1
以卢卡斯的评论为基础:
=SUM(SUMIFS(D:D,C:C,"LAST",A:A,{"a","b","c"})-SUMIFS(D:D,C:C,"FIRST",A:A,{"a","b","c"}))/3