使用INDEX/COLLECT返回多个值

Jaye Casciano
Jaye Casciano ✭✭✭✭✭✭

寻找使用INDEX/COLLECT返回多个值的正确方法。我假设JOIN需要在那里,但不能让它工作!无论使用JOIN还是不使用JOIN,公式仍然只产生第一个值。此公式将一个项目编号从一个工作表匹配到另一个工作表,并且应该返回分配给该项目的所有资源(在源工作表中显示为每行一个资源,所有行都填写了项目编号字段)。欧宝体育app官方888


这是我想要解决的问题:

=JOIN((INDEX(COLLECT({源表资源名称},{源表项目编号},[项目编号]@row), 1), ", ")


注意,这是在联系人列中,理想情况下,我希望返回的值是联系人,而不是纯文本……但这样想可能是不可能的。感谢任何输入!

标签:

最佳答案

  • 吉纳维芙P。
    吉纳维芙P。 员工管理
    ✓回答

    @Jaye Tatone

    INDEX函数是导致输出只返回一个值的原因。你可以直接向右跳到JOIN()没有INDEX的COLLECT。试试这个:

    =JOIN(COLLECT({源表资源名称},{源表项目编号},[项目编号]@row), ", ")

    您是正确的,目前这种类型的公式将无法填充联系人;JOIN(COLLECT)将把这些值作为文本传递。请记住,如果在两个不同的行中将相同的资源分配给相同的项目,则将在此单元格中显示其名称两次。

    让我知道这是否适合你!

    欢呼,

    吉纳维芙

答案

  • 吉纳维芙P。
    吉纳维芙P。 员工管理
    ✓回答

    @Jaye Tatone

    INDEX函数是导致输出只返回一个值的原因。你可以直接向右跳到JOIN()没有INDEX的COLLECT。试试这个:

    =JOIN(COLLECT({源表资源名称},{源表项目编号},[项目编号]@row), ", ")

    您是正确的,目前这种类型的公式将无法填充联系人;JOIN(COLLECT)将把这些值作为文本传递。请记住,如果在两个不同的行中将相同的资源分配给相同的项目,则将在此单元格中显示其名称两次。

    让我知道这是否适合你!

    欢呼,

    吉纳维芙

  • @Genevieve P是否有一种方法可以使用JOIN-COLLECT来填充联系人?我试图做类似的事情,但需要拉在联系,而不是文本。或者我可以使用另一个函数/函数组合来完成此操作?

  • 吉纳维芙P。
    吉纳维芙P。 员工管理

    @Tracey卡茨

    您是否可以更详细地解释一下您的流程,也许可以提供两张表的屏幕截图(但屏蔽掉任何敏感数据)?

    没有办法引入多个单独的联系人,并通过公式将它们连接到一个联系人列单元格中,但如果一个单元格中已经有多个联系人,可能有办法将完整的单元格复制到另一个工作表,或者在该单元格中进行搜索。

  • @Genevieve P。

    是否有可能使用=Join(Collect)来带回多个值,但不是逗号分隔的列表,而是将值填充在不同行的同一列中?我使用连接/收集与“文本到列”选项,如excel,它似乎不是一个选项。

    我试图拉到一个表,从一个单独的表,所有的项目名称都与一个人的名字相关联。问题是,多个人员可以分配到一个项目,所以我不能使用报告。

    谢谢你的帮助。

    摩根

  • 吉纳维芙P。
    吉纳维芙P。 员工管理
    编辑12/13/21

    @mtk5200

    JOIN(COLLECT)只能将数据连接到一个细胞而不是按行拆分数据。

    不过,也许我们有办法做到这一点。你知道有多少可能的项目名称吗?比如,最多10个?

    我们可以使用INDEX(COLLECT)公式来查找第一个匹配项,然后在第二行更改公式以查找第二个匹配,等等。

    例如:

    =INDEX(收集({项目名称},{分配的人员},HAS(@cell,(电子邮件保护))), 1)

    最后的1告诉公式返回第一行。

    然后在该用户的第二行中,将其更新为:

    =INDEX(收集({项目名称},{分配的人员},HAS(@cell,(电子邮件保护))),2)

    如果您知道可以分配给某人的项目的最大数量,则可以提前设置工作表并将数字放在单元格中。然后您可以引用单元格,而不是写1或2。下面是我的意思的一个例子:

    截屏20121-12-13下午1.01.19。png

    欢呼,

    吉纳维芙

  • 戈
    ✭✭✭
    编辑03/14/22

    @Genevieve P。

    我用的是最后一个例子,它在表格中很好地工作。试图修改,以引用另一张表,但无法解析

    当然,我错误地插入了对另一张表的引用。这里的引用有什么问题吗?

    =INDEX(COLLECT({综合发射计划范围1}[任务名称]:[任务名称],{综合发射计划范围1}[优先焦点标志]:[优先焦点标志],HAS({综合发射计划范围1}@cell, "本地优先级")),3)

    最好的

  • 吉纳维芙P。
    吉纳维芙P。 员工管理

    @Marcin

    这里有几个语法错误。

    在COLLECT函数中列出的第一项是希望从中提取数据的列。然后在它后面列出每个列和标准。

    所以在你的情况下,范围1应该是列带回来的数据。

    =INDEX(收集{综合发射计划靶场1})

    如果你想找一个特定的任务名称,范围2将是另一张表中的任务名称列:

    =INDEX(收集{综合发射计划范围1},{综合发射计划范围2}

    如果在编写公式的同一行的单元格中搜索Task Name,则引用是[Task Name]@row

    =INDEX(收集{综合发射计划靶场1},{综合发射计划靶场2},(任务名称)@row

    接下来我们列出多选择列,听起来像是“优先焦点标志”在另一张纸上。这是范围3:

    =INDEX(收集{综合发射计划靶场1},{综合发射计划靶场2},[任务名称]@row,{综合发射计划范围3}

    然后你在多选中寻找的是“本地优先级”,你可以使用HAS(@cell)在前面规定的范围内搜索它:

    =INDEX(收集{综合发射计划靶场1},{综合发射计划靶场2},[任务名称]@row,{综合发射计划3},HAS(@cell, "Local Priority")), 1)

    最后总是需要一个1因为它告诉INDEX函数带回来。明白了吗?


    如果这个公式对你不起作用,请张贴屏幕截图,你当前的源表和你写公式的工作表,确定你想要匹配的列和你想要带回的列,但请删除敏感数据。

    干杯!

    吉纳维芙

帮助文章参考资料欧宝体育app官方888

想要直接在智能表中练习使用公式吗?

请查看公式手册模板!
Hey @Ed Smartsheet<\/a> <\/p>

In addition to the IFERROR, it looks like you have the , 0 in the INDEX portion of the formula instead of the MATCH. Try moving it in one:<\/p>

=INDEX({Contract Focal Point}, MATCH([Contract No.]@row, {Contract No.}, 0))<\/strong><\/p>

Cheers,<\/p>

Genevieve<\/p>"}]}},"status":{"statusID":3,"name":"Accepted","state":"closed","recordType":"discussion","recordSubType":"question"},"bookmarked":false,"unread":false,"category":{"categoryID":322,"name":"Formulas and Functions","url":"https:\/\/community.smartsheet.com\/categories\/formulas-and-functions","allowedDiscussionTypes":[]},"reactions":[{"tagID":3,"urlcode":"Promote","name":"Promote","class":"Positive","hasReacted":false,"reactionValue":5,"count":0},{"tagID":5,"urlcode":"Insightful","name":"Insightful","class":"Positive","hasReacted":false,"reactionValue":1,"count":0},{"tagID":11,"urlcode":"Up","name":"Vote Up","class":"Positive","hasReacted":false,"reactionValue":1,"count":0},{"tagID":13,"urlcode":"Awesome","name":"Awesome","class":"Positive","hasReacted":false,"reactionValue":1,"count":0}],"tags":[{"tagID":254,"urlcode":"Formulas","name":"Formulas"}]},{"discussionID":106550,"type":"question","name":"Invalid Operation","excerpt":"Good morning, I am trying to sum the entries that are greater than 30 but less than 60 days old. =SUMIFS({011-AP Archive -# of Days to Complete}, >30, {011-AP Archive -# of Days to Complete}, <60) I was able to do this same formula with a COUNTIFS but its' not working the same, what am I missing.","categoryID":322,"dateInserted":"2023-06-16T15:00:58+00:00","dateUpdated":null,"dateLastComment":"2023-06-16T15:22:46+00:00","insertUserID":156010,"insertUser":{"userID":156010,"name":"AliT","url":"https:\/\/community.smartsheet.com\/profile\/AliT","photoUrl":"https:\/\/aws.smartsheet.com\/storageProxy\/image\/images\/u!1!80tRN2Ch-HQ!nDHdH1rxiPw!1_-nYVqJJzq","dateLastActive":"2023-06-16T15:22:32+00:00","banned":0,"punished":0,"private":false,"label":"✭✭"},"updateUserID":null,"lastUserID":156010,"lastUser":{"userID":156010,"name":"AliT","url":"https:\/\/community.smartsheet.com\/profile\/AliT","photoUrl":"https:\/\/aws.smartsheet.com\/storageProxy\/image\/images\/u!1!80tRN2Ch-HQ!nDHdH1rxiPw!1_-nYVqJJzq","dateLastActive":"2023-06-16T15:22:32+00:00","banned":0,"punished":0,"private":false,"label":"✭✭"},"pinned":false,"pinLocation":null,"closed":false,"sink":false,"countComments":2,"countViews":34,"score":null,"hot":3373857824,"url":"https:\/\/community.smartsheet.com\/discussion\/106550\/invalid-operation","canonicalUrl":"https:\/\/community.smartsheet.com\/discussion\/106550\/invalid-operation","format":"Rich","lastPost":{"discussionID":106550,"commentID":381027,"name":"Re: Invalid Operation","url":"https:\/\/community.smartsheet.com\/discussion\/comment\/381027#Comment_381027","dateInserted":"2023-06-16T15:22:46+00:00","insertUserID":156010,"insertUser":{"userID":156010,"name":"AliT","url":"https:\/\/community.smartsheet.com\/profile\/AliT","photoUrl":"https:\/\/aws.smartsheet.com\/storageProxy\/image\/images\/u!1!80tRN2Ch-HQ!nDHdH1rxiPw!1_-nYVqJJzq","dateLastActive":"2023-06-16T15:22:32+00:00","banned":0,"punished":0,"private":false,"label":"✭✭"}},"breadcrumbs":[{"name":"Home","url":"https:\/\/community.smartsheet.com\/"},{"name":"Formulas and Functions","url":"https:\/\/community.smartsheet.com\/categories\/formulas-and-functions"}],"groupID":null,"statusID":3,"attributes":{"question":{"status":"accepted","dateAccepted":"2023-06-16T15:22:31+00:00","dateAnswered":"2023-06-16T15:19:44+00:00","acceptedAnswers":[{"commentID":381026,"body":"

Try this:<\/p>

SUMIFS({011-AP Archive -# of Days to Complete}, {011-AP Archive -# of Days to Complete}, > 30, {011-AP Archive -# of Days to Complete}, < 60)<\/p>

With SUMIFS, you have to include the range to SUM separately from the ranges to compare. In your scenario, they are the same, but can be different.<\/p>

SUMIFS( range, criterion_range1, criterion1, [ criterion_range2, ​criterion2​... ])<\/p>"}]}},"status":{"statusID":3,"name":"Accepted","state":"closed","recordType":"discussion","recordSubType":"question"},"bookmarked":false,"unread":false,"category":{"categoryID":322,"name":"Formulas and Functions","url":"https:\/\/community.smartsheet.com\/categories\/formulas-and-functions","allowedDiscussionTypes":[]},"reactions":[{"tagID":3,"urlcode":"Promote","name":"Promote","class":"Positive","hasReacted":false,"reactionValue":5,"count":0},{"tagID":5,"urlcode":"Insightful","name":"Insightful","class":"Positive","hasReacted":false,"reactionValue":1,"count":0},{"tagID":11,"urlcode":"Up","name":"Vote Up","class":"Positive","hasReacted":false,"reactionValue":1,"count":0},{"tagID":13,"urlcode":"Awesome","name":"Awesome","class":"Positive","hasReacted":false,"reactionValue":1,"count":0}],"tags":[]},{"discussionID":106528,"type":"question","name":"Formula Calculation with a zero value denominator","excerpt":"I'm trying to create a formula to calculate the # Hours per remaining week based off the total HOURS remaining. Calculation takes into consideration the calculated remaining # of weeks on a project. Logic should be: Take Remaining hours \/ # of remaining weeks. If remaining weeks is < 1, simply return the amount of…","categoryID":322,"dateInserted":"2023-06-15T20:54:01+00:00","dateUpdated":null,"dateLastComment":"2023-06-16T16:47:02+00:00","insertUserID":161931,"insertUser":{"userID":161931,"name":"Christine Cao","title":"Engagement Manager","url":"https:\/\/community.smartsheet.com\/profile\/Christine%20Cao","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/defaultavatar\/nWRMFRX6I99I6.jpg","dateLastActive":"2023-06-16T16:47:14+00:00","banned":0,"punished":0,"private":false,"label":"✭"},"updateUserID":null,"lastUserID":161931,"lastUser":{"userID":161931,"name":"Christine Cao","title":"Engagement Manager","url":"https:\/\/community.smartsheet.com\/profile\/Christine%20Cao","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/defaultavatar\/nWRMFRX6I99I6.jpg","dateLastActive":"2023-06-16T16:47:14+00:00","banned":0,"punished":0,"private":false,"label":"✭"},"pinned":false,"pinLocation":null,"closed":false,"sink":false,"countComments":2,"countViews":21,"score":null,"hot":3373797663,"url":"https:\/\/community.smartsheet.com\/discussion\/106528\/formula-calculation-with-a-zero-value-denominator","canonicalUrl":"https:\/\/community.smartsheet.com\/discussion\/106528\/formula-calculation-with-a-zero-value-denominator","format":"Rich","tagIDs":[254],"lastPost":{"discussionID":106528,"commentID":381042,"name":"Re: Formula Calculation with a zero value denominator","url":"https:\/\/community.smartsheet.com\/discussion\/comment\/381042#Comment_381042","dateInserted":"2023-06-16T16:47:02+00:00","insertUserID":161931,"insertUser":{"userID":161931,"name":"Christine Cao","title":"Engagement Manager","url":"https:\/\/community.smartsheet.com\/profile\/Christine%20Cao","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/defaultavatar\/nWRMFRX6I99I6.jpg","dateLastActive":"2023-06-16T16:47:14+00:00","banned":0,"punished":0,"private":false,"label":"✭"}},"breadcrumbs":[{"name":"Home","url":"https:\/\/community.smartsheet.com\/"},{"name":"Formulas and Functions","url":"https:\/\/community.smartsheet.com\/categories\/formulas-and-functions"}],"groupID":null,"statusID":3,"image":{"url":"https:\/\/us.v-cdn.net\/6031209\/uploads\/09DN1EF6F1P9\/image.png","urlSrcSet":{"10":"","300":"","800":"","1200":"","1600":""},"alt":"image.png"},"attributes":{"question":{"status":"accepted","dateAccepted":"2023-06-16T16:47:11+00:00","dateAnswered":"2023-06-16T11:42:38+00:00","acceptedAnswers":[{"commentID":380991,"body":"

Hi @Christine Cao<\/a>,<\/p>

It's down to your formula and rounding. What's happening is that you have 0.3 of a week (which I'm guessing is actually 2 days - 0.2857..., rounded to 0.3). If you calculate 321.5\/(2\/7), you end up with the 1125.3 (to 1 dp).<\/p>

You can get round this by altering your formula to do what you're actually after:<\/p>

=IF([Column2]9 >= 1, [Column3]@row \/ [Column2]9, MAX([Column3]@row, 0))<\/p>

This should make it so if weeks remaining is equal to or greater than 1 it will do the calculation, and otherwise take the MAX of either 0 or column 3.<\/p>

Give this a try and hopefully it should resolve your issue!<\/p>"}]}},"status":{"statusID":3,"name":"Accepted","state":"closed","recordType":"discussion","recordSubType":"question"},"bookmarked":false,"unread":false,"category":{"categoryID":322,"name":"Formulas and Functions","url":"https:\/\/community.smartsheet.com\/categories\/formulas-and-functions","allowedDiscussionTypes":[]},"reactions":[{"tagID":3,"urlcode":"Promote","name":"Promote","class":"Positive","hasReacted":false,"reactionValue":5,"count":0},{"tagID":5,"urlcode":"Insightful","name":"Insightful","class":"Positive","hasReacted":false,"reactionValue":1,"count":0},{"tagID":11,"urlcode":"Up","name":"Vote Up","class":"Positive","hasReacted":false,"reactionValue":1,"count":0},{"tagID":13,"urlcode":"Awesome","name":"Awesome","class":"Positive","hasReacted":false,"reactionValue":1,"count":0}],"tags":[{"tagID":254,"urlcode":"Formulas","name":"Formulas"}]}],"initialPaging":{"nextURL":"https:\/\/community.smartsheet.com\/api\/v2\/discussions?page=2&categoryID=322&includeChildCategories=1&type%5B0%5D=Question&excludeHiddenCategories=1&sort=-hot&limit=3&expand%5B0%5D=all&expand%5B1%5D=-body&expand%5B2%5D=insertUser&expand%5B3%5D=lastUser&status=accepted","prevURL":null,"currentPage":1,"total":10000,"limit":3},"title":"Trending in Formulas and Functions ","subtitle":null,"description":null,"noCheckboxes":true,"containerOptions":[],"discussionOptions":[]}">

公式和函数趋势