英文:
How do I join text of expanding cell ranges in a spilt array?
问题
我正在创建一个每日计划,将员工分配处理客户电话(C)或电子邮件(E)的工作。我想在表格内应用规则,以便经理不必亲自进行调整。
在我的工作中,计划分为A到D四个部分:
- A - 包括员工的数据,包括姓名、开始/结束时间、休息时间、技能等。
- B - 辅助“表格”根据前一个小时的规则进行处理,并为每个小时、每个员工提供数字结果。
- C - 计划“表格”分配C给所有员工,但不分配给结果最低的员工,他们会被分配E。
- D - 包含在部分B内处理的每个规则的加减数量。
我已经链接了一个简化示例计划的截图。部分B已经分成B1和B2,以帮助说明情况。
部分B内的公式首先识别员工是否在他们的工作时间内,这个单一公式扩展到一天中的所有员工的所有小时范围内[截图中的B1]。
现在,假设一个规则是每个员工每天只能分配3小时的电子邮件(E)。我计划这样做的方式是让部分B连接所有直到处理的小时的文本[截图中的B2],从中可以计算E的数量。如果E的数量等于3,那么将10添加到该员工的“得分”中。如果其余员工的得分为零,那么部分C将为其中一个员工分配E,而得分为10的员工将分配C。
其他规则都进展顺利,直到我遇到了这个问题,我认为从确定员工是否在工作的这个小时的范围内拆分的问题。
我想要的结果显示在B2中,但我得到的是X,它将整个范围从左到右、从上到下连接在一起。
我知道在Excel 365中可以使用@符号,但我使用的是Mac OS设备,不支持该功能。最终产品将在Windows上运行,但我更喜欢Mac上的设置来完成这样的工作。
注意:
- 假定如果两个或多个分数相同,E将按员工姓名的字母顺序分配。
- 我决定不使用COUNTIF(),因为有多个规则,使用一个连接的文本进行处理似乎比countif这个那个更容易。
- 我宁愿保留扩展数组,因为在开发时跨多个列/行拖动它会很麻烦。
- 没有VBA或宏(受IT限制)。
- 没有不稳定的函数。
- 这是现有软件包中的调度选项之一,但也是我喜欢解决的难题,但我在这个问题上碰到了困难!
我尝试了很多公式,孤立地最接近我想要的结果,但一旦将该公式文本引入生成拆分数组的公式,它就会连接整个范围,如X所示,我找不到阻止它的方法。
例如:
=INDEX(SCAN("",RotaRange,(LAMBDA(a,v,a&v))),1,)
在多行上拖动得很好,但在扩展数组中它连接了所有内容。
我尝试了太多组合,无法列出它们,但它们包括各种形式的以下函数:index()、take()、chooserows()、row()、rows()、hstack()、makearray()、match()、xlookup()、find()、textjoin()、concat()、scan()等等。
我在这个问题上花了比我愿意承认的更多时间,我查阅了Stack Overflow、Google等等,以及自己的测试和实验,但我无法解决这个问题!
英文:
I am creating a daily schedule to assign employees to handle customer calls (C) or emails (E). I want to apply rules to the allocation of C/E within the sheet so managers don't have to make adjustments themselves.
In my WIP schedule there are 4 parts A to D;
- A - Employee data including name, start/finish time, break time, skills etc
- B - Helper 'table' processes rules based on the hour before it and provides a numerical result per hour, per employee
- C - The schedule 'table' allocates Cs to all but the employee with the lowest result who is given Es
- D - Contains the amount to add or subtract for each rule processed within Part B
I've linked a screenshot of a simplified example of the schedule below. Part B has been split showing B1 and B2 to help show what's going on.
The formula within Part B first identifies if the employee is within their working hours, this single formula spills across the entire range encompassing all employees for each hour of the day [B1 in the screenshot].
Now let's say a rule is that each employee is only given 3 hours of Emails (E) each day. The way I planned to do this was for Part B to join the text of all hours up to the hour being processed [B2 in the screenshot], from which the number of Es can be counted. If the number of Es equals 3 then add 10 to that employees 'score'. If the remaining employees have a score of zero then Part C would allocate Es to one of them, and Cs for the employee with the score of 10.
All was going well with other rules until I reached this problem and I think the spilt range from working out if the employees are working that hour is the issue.
The result I want is shown at B2 but what I get is X which joins the text left to right, top to bottom, of the entire range.
I'm aware of the use of @ in Excel 365, however I'm on a Mac OS device and it doesn't play ball. The final product would however run on Windows, but I prefer the Mac setup to do this kind of work on.
Notes:
- Assume that where two or more scores are the same that the E will be allocated in alphabetical order of employee name,
- I decided against COUNTIF() as with multiple rules it seemed easier to have one joined-text to process rather than countif this and that,
- I'd prefer to keep the spilling array as it's a hassle dragging it across numerous columns/rows especially when developing this,
- No VBA or Macros (forbidden by IT),
- No volatile functions,
- This is one option for scheduling among existing software packages, but also the sort of puzzle I enjoy solving, but I met my match with this!
I have tried a lot of formulas and the closest I've got in isolation does what I want row by row, but the moment I introduce that formula text to the formula producing the spilt array it joins the entire range as shown in X and I cannot find a way to stop that.
For example;
=INDEX(SCAN("",RotaRange,(LAMBDA(a,v,a&v))),1,)
Works fine to drag down over multiple rows, but in the spilled array it joins everything.
I have tried too many combinations to list them but they've included one or more of the following functions in various guises: index(), take(), chooserows(), row(), rows(), hstack(), makearray(), match(), xlookup(), find(), textjoin(), concat(), scan() and more I'm sure.
I've spent more days on this than I care to admit, I've been through SO, Google as you'd expect as well as my own tests and experiments but I can't get past this one!
答案1
得分: 1
=LET(range, RotaRange,
DROP(REDUCE("""", SEQUENCE(ROWS(range)), LAMBDA(rRes, rr,
VSTACK(rRes, SCAN("""", INDEX(range, rr, 0), LAMBDA(sRes, sVal, sRes&sVal))))), 1))
Possibly, you will need to drop the last column of RotaRange
:
=LET(range, Drop(RotaRange, , -1),
DROP(REDUCE("""", SEQUENCE(ROWS(range)), LAMBDA(rRes, rr,
VSTACK(rRes, SCAN("""", INDEX(range, rr, 0), LAMBDA(sRes, sVal, sRes&sVal))))), 1))
英文:
A REDUCE/SCAN
=LET(range,RotaRange,
DROP(REDUCE("",SEQUENCE(ROWS(range)),LAMBDA(rRes,rr,
VSTACK(rRes,SCAN("",INDEX(range,rr,0),LAMBDA(sRes,sVal,sRes&sVal))))),1))
Possibly, you will need to drop the last column of RotaRange
:
=LET(range,Drop(RotaRange,,-1),
DROP(REDUCE("",SEQUENCE(ROWS(range)),LAMBDA(rRes,rr,
VSTACK(rRes,SCAN("",INDEX(range,rr,0),LAMBDA(sRes,sVal,sRes&sVal))))),1))
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论