Excel:自动将员工分配到他们的专业领域

发布于 2025-01-21 05:34:31 字数 796 浏览 0 评论 0 原文

我一直在尝试构建一个将有3列的表,并根据其中一列的标准分配员工。我们的列只是A,B和C。在A列中,将有一个文件编号,该号码将手动添加,B列将是该区域,并将通过数据验证从下拉列表中手动添加。 CI栏希望从该领域的“专家”列表中获得“自动填充”。每位员工有100%的时间可用,因此可以有一些旋转时间将不止一次。 是视觉辅助列表的示例:

数据集

这 选择(区域),C列将从F,G和H列中表中的工作人员中“随机选择”及其各自的专业领域。这是我想要的结果的另一个视觉效果:

结果表

是否有列的代码C获得结果?我尝试了许多 = rand = randbetweew ,我还使用以下公式来创建另一个下拉列表以通过数据验证,这起作用:

= offset(table1!$ f $ 1,1,匹配($ b2,table2!$ f $ 1:$ h $ 1,0)-1,counta(offset!$ f $ 1,1,匹配($ b2,设置! $ f $ 1:$ h $ 1,0)-1,3)),1)

,但我希望它自动化以消除从下拉菜单中选择的步骤,因为这也在B列中完成。还是这是VBA类型的构建,因为此列表会随着时间的推移而增长?

感谢您抽出宝贵的时间协助,我将出于任何疑问。

I have been trying to build a table that will have 3 columns and assign staff based on a criteria from one of the columns. Our columns are simply A, B, and C. In column A, there will be a filing number that will be added manually and column B will be the Area and will be added manually from a drop down list via Data Validation. Column C I would like to have 'auto-populated' from a list of staff that are 'experts' in that area. Each staff is available 100% of the time so there can be times of rotation that will have their name more than once. Here is an example of those list for visual aid:

Data set

So when each area from column B (Area) is selected, Column C will 'random select' from the staff in the table shown in column F, G, and H with their respective areas of expertise. Here is a another visual of the result I would like:

Result Table

Is there a code for column C to get that result? I have tried a number of =rand or =randbetween and I also used the following formula to create another drop down list to manual select, again through data validation and this works:

=OFFSET(TABLE1!$F$1,1,MATCH($B2,TABLE2!$F$1:$H$1,0)-1,COUNTA(OFFSET(Settings!$F$1,1,MATCH($B2,Settings!$F$1:$H$1,0)-1,3)),1)

but I want it to be automated to eliminate that step of selecting from a dropdown since this is done in column B as well. Or is this a VBA type of build as this list will grown over time?

Thank you for taking the time to assist and I will be available for any questions.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

多彩岁月 2025-01-28 05:34:31

请参阅此Google表。 excel中的公式应相同:

如果您将专业列表重新格式化为两列,则可以使用一列,其中一列可以更轻松地使用

=index(unique(filter(E:E, F:F=B2)), randBetween(1,COUNTA(unique(filter(E:E, F:F=B2)))))

更轻松地阅读:

=index(
  unique(filter(E:E, F:F=B2)), 
  randBetween(1, COUNTA(unique(filter(E:E, F:F=B2))))
)

:您可以 过滤器获取匹配名称的列表。我将其包裹在唯一的情况下,以防万一错误的多个条目和相同的专业。

unique(filter(E:E, F:F=B2))

您可以将其传递给counta以获取匹配名称的计数:

COUNTA(unique(filter(E:E, F:F=B2)))

并在介于介于1和匹配数之间获取随机数:

randBetween(1, COUNTA(unique(filter(E:E, F:F=B2))))

然后使用索引将nth名称从列表中获取,其中第一个参数为唯一的过滤列表和第二个参数是与randbeteween生成的数字。

Excel具有一个LET功能,可以让您重复使用参数,并且可能更简单地阅读或维护。这不在表格中,因为我认为Google表具有该功能。

=LET(
  list, UNIQUE(FILTER(E:E, F:F=B2)),
  INDEX(list, RANDBETWEEN(1, COUNTA(list)))
)

让以最终参数为输出,将成对的名称/值作为参数。这里列表是名称,唯一/过滤器组合是定义。然后,您可以在输出公式中使用名称,

INDEX(list, RANDBETWEEN(1, COUNTA(list)))

让我知道这是否适合您。

See this google sheet. The formulas should be the same in Excel:

https://docs.google.com/spreadsheets/d/1bCVsCxXnG3an1LZSCwVdzlZCSSctxdfy3WHQ7RisOY4/edit#gid=0

If you reformat the specialty list to two columns, with one column for the name and one for the specialty, you can use

=index(unique(filter(E:E, F:F=B2)), randBetween(1,COUNTA(unique(filter(E:E, F:F=B2)))))

Reformatted for easier reading:

=index(
  unique(filter(E:E, F:F=B2)), 
  randBetween(1, COUNTA(unique(filter(E:E, F:F=B2))))
)

You use FILTER to get the list of matching names. I wrapped that in UNIQUE just in case there were mistaken multiple entries for the same name and same specialty.

unique(filter(E:E, F:F=B2))

You can pass that to COUNTA to get the count of matching names:

COUNTA(unique(filter(E:E, F:F=B2)))

And use that in RANDBETWEEN to get a random number between 1 and the number of matches:

randBetween(1, COUNTA(unique(filter(E:E, F:F=B2))))

Then use INDEX to get the nth name out of the list, where the first argument is the unique filtered list and the second argument is the number generated with RANDBETWEEN.

Excel has a LET function which will let you reuse arguments, and may be simpler to read or maintain. This is not in the sheet, since I don't think Google Sheets has that function.

=LET(
  list, UNIQUE(FILTER(E:E, F:F=B2)),
  INDEX(list, RANDBETWEEN(1, COUNTA(list)))
)

LET takes pairs of name/values as arguments, with a final argument that is the output. Here list is the name and the unique/filter combo is the definition. Then you can use the name in the output formula

INDEX(list, RANDBETWEEN(1, COUNTA(list)))

Let me know if this works for you.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文