0

我有一组定义一组业务规则的电子表格。这些业务规则然后由我们的系统处理。

创建电子表格的用户天真地这样做,我发现通过跨行分解数据 - 从而减少规则的数量 - 大大提高了系统的性能。

其中一个“天真的”结构化电子表格可能如下所示:

+-----------+------------+------------+------------+------------+--------+
| Rule Name | Criteron 1 | Criteron 2 | Criteron 3 | Criteron 4 | Accept |
+-----------+------------+------------+------------+------------+--------+
| Rule 1    |      A     |      B     |      C     |            |  Yes   |
| Rule 2    |      A     |      C     |      C     |            |  Yes   |
| Rule 3    |      A     |      D     |      C     |            |  Yes   |
| Rule 4    |      A     |      E     |      C     |            |  Yes   |
| Rule 5    |      A     |      F     |      C     |            |  Yes   |
| Rule 6    |      A     |      B     |      D     |            |  Yes   |
| Rule 7    |      A     |      C     |      D     |            |  Yes   |
| Rule 8    |      A     |      D     |      D     |            |  Yes   |
| Rule 9    |      A     |      E     |      D     |            |  Yes   |
| Rule 10   |      A     |      F     |      D     |            |  Yes   |
| Rule 11   |      A     |      B     |      E     |            |  Yes   |
| Rule 12   |      A     |      C     |      E     |            |  Yes   |
| Rule 13   |      A     |      D     |      E     |            |  Yes   |
| Rule 14   |      A     |      E     |      E     |            |  Yes   |
| Rule 15   |      A     |      F     |      E     |            |  Yes   |
| Rule 16   |            |            |            |     G      |  Yes   |
| Rule 17   |            |            |            |     H      |  Yes   |
| Rule 18   |            |            |            |     I      |  Yes   |
| Rule 19   |            |            |            |     J      |  Yes   |
| Rule 20   |            |            |            |     K      |  Yes   |
| Rule 21   |            |            |            |     L      |  Yes   |
| Rule 22   |            |            |            |     M      |  Yes   |
| Rule 23   |            |            |            |     N      |  No    |
| Rule 24   |            |            |            |     O      |  No    |
| Rule 25   |            |            |            |     P      |  No    |
| Rule 26   |            |            |            |     Q      |  No    |
| Rule 27   |            |            |            |     R      |  No    |
| Rule 28   |            |            |            |     S      |  No    |
| Rule 29   |      A     |      J     |      F     |            |  No    |
| Rule 30   |      A     |      K     |      F     |            |  No    |
+-----------+------------+------------+------------+------------+--------+

例如,规则 1 将被评估为:

IF (Criterion 1 == A) AND (Criterion 2 == B) AND (Criterion 3 == C) THEN Accept

稍加思考并假设我们可以在列中使用 OR 条件,上面的内容可以简化为:

+-----------+------------+------------+------------+-------------+--------+
| Rule Name | Criteron 1 | Criteron 2 | Criteron 3 | Criteron 4  | Accept |
+-----------+------------+------------+------------+-------------+--------+
| Rule 1    |      A     |  B,C,D,E,F |    C,D,E   |             |  Yes   |
| Rule 2    |            |            |            |G,H,I,J,K,L,M|  Yes   |
| Rule 3    |            |            |            |N,O,P,Q,R,S  |  No    |
| Rule 4    |      A     |     J,K    |      F     |             |  No    |
+-----------+------------+------------+------------+-------------+--------+

规则 1 现在评估如下:

IF (Criterion 1 == A) AND 
   (Criterion 2 == B OR Criterion 2 == C OR...) AND 
   (Criterion 3 == C OR Criterion 3 == D OR...) THEN Accept

现在,我已经手动完成了。我想知道的是:Excel 是否具有内置功能来为我进行这种分组。如果没有,谁能指出我的算法方向,这将帮助我有效地实现这一点?

4

1 回答 1

0

这看起来像这样一种情况,您可以使用 SQL 查询中的 GROUP BY HAVING 将使用 ADO 和 OLE DB 的表查询到 ADO 记录集中,然后使用CopyFromRecordset将(分组的)结果转储到新工作表中

或者,也许是数据透视表?

于 2013-04-09T14:50:41.717 回答