简体   繁体   English

Excel 公式 LET function 基于 Criteria

[英]Excel Formula LET function based on Criteria

Self-Learning Excel, Im new with the LET function and i am Looking for a fix to the below formula, where B5144 is user input for Date in which the LET function will create a table based on user input in B5144 (Filter records where date values are matching with B5144). Self-Learning Excel, Im new with the LET function and i am Looking for a fix to the below formula, where B5144 is user input for Date in which the LET function will create a table based on user input in B5144 (Filter records where date值与 B5144 匹配)。

Either using an IF/ Filter function as validation before generating a result.在生成结果之前使用 IF/过滤器 function 作为验证。 Where only records in the table that match the date value in B5144 will be displayed.仅显示表中与 B5144 中的日期值匹配的记录。

=SORT((LET(x,UNIQUE(D2:D5140),y,SUMIFS(J2:J5140,D2:D5140,x),CHOOSE({1,2},x,y))))

在此处输入图像描述

If you are going to use a dynamic array (filter) you are going to have to start with the filter and work your way out:如果您要使用动态数组(过滤器),您将不得不从过滤器开始并解决问题:

FILTER(A2:J5140,A2:A5140=B5144)过滤器(A2:J5140,A2:A5140=B5144)

Once you have this "sub array" it is the only thing you will use, you will make no further references to A:xxx or J:xxx.一旦你有了这个“子数组”,它就是你将使用的唯一东西,你将不再引用 A:xxx 或 J:xxx。

LET(results,FILTER(A2:J5140,A2:A5140=B5144),
A, index(results,,1),
x, index(results,,4),
y, index(results,,10)   )

And then move on from there.然后从那里继续前进。

results is a variable height x 10 column width array.结果是一个可变高度 x 10 列宽数组。

A, x, and Y are the same variable height x 1 column width array. A、x 和 Y 是相同的可变高度 x 1 列宽数组。

I believe your "unique" function is going to create a hot mess unless you are really clear in your logic.我相信您的“独特” function 会造成混乱,除非您的逻辑非常清楚。 Array "x" will often be shorter in length than A and y, and this may or may not be what you want.数组“x”的长度通常比 A 和 y 短,这可能是也可能不是您想要的。

You may have to nest Filters: =Filter( Filter( xx by date ) by unique D )您可能必须嵌套过滤器: =Filter( Filter( xx by date ) by unique D )

In this way, you always end up with a matched A, x, and y array.这样,您总是会得到一个匹配的 A、x 和 y 数组。

Hope this helps get you in the right direction.希望这可以帮助您朝着正确的方向前进。 Let us know if you need more.如果您需要更多,请告诉我们。 ———- Edit: I only recently came to overflow from stackexchange so I don't have enough points to make comments yet, so I'll respond here. ----- 编辑:我最近才从 stackexchange 溢出,所以我还没有足够的积分来发表评论,所以我会在这里回复。

My formula above just does the filter and sets the definitions, are you then entering your desired formula at the end just inside the final parenthesis?我上面的公式只是过滤并设置定义,然后你在最后的括号内输入你想要的公式吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM