0

在成功开发数据库/应用程序之后,我的任务是创建一个非常高级的电子表格,供我们的招聘团队使用。

长话短说,有一个公式可以计算出营地的“所需员工”与“参加者”。

考勤和员工数据正在通过 ODBC 连接提取另外两个工作表,并变成漂亮的数据透视表。

有一个相当容易理解,但最终在程序上相当复杂的计算要完成。这大约需要 8 个步骤。

鉴于 [据我所知] 你不能在单元格中创建短期变量,并且结合引用外部单元格的事实需要相当多的字符,我最终得到了一个视觉上(如果不是概念上)的复杂公式。

最终......由于我使用 IFERROR() 添加了一些数据验证来解决数据的不确定性,这意味着我实际上已经达到了单元格的字符限制(大约 8100 个字符)。我尝试 FSVO 缩小单元格,但这并没有让我回到极限以下。

所以 - 现在你知道了问题 - 这是一组问题:

  • 有没有办法扩大限制?
  • 有没有办法在单元格内制作变量(这也可以解决问题)?
  • VB适合这类问题吗?

我怀疑答案将是:“去学习一些 VB”......我试图避免。我认为我离限制大约 3 行,鉴于这是一个久经考验的解决方案,不得不重新编码它是一种耻辱。

编辑包括公式

=IF(
    OR(
        IFERROR(
        GETPIVOTDATA("Child ID",'Child Numbers 2013'!$A$1,"Venue",$A4,"Age group","4/5 years","Activity","Multi-Active","date",B$1-DATE(YEAR(B$1),1,0)),0),
        IFERROR(
        GETPIVOTDATA("Child ID",'Child Numbers 2013'!$A$1,"Venue",$A4,"Age group","6/7 years","Activity","Multi-Active","date",B$1-DATE(YEAR(B$1),1,0)),0),
        IFERROR(
        GETPIVOTDATA("Child ID",'Child Numbers 2013'!$A$1,"Venue",$A4,"Age group","8 + years","Activity","Multi-Active","date",B$1-DATE(YEAR(B$1),1,0)),0),

        IFERROR(
        GETPIVOTDATA("Child ID",'Child Numbers 2013'!$A$1,"Venue",$A4,"Age group","4/5 years","Activity","ISS","date",B$1-DATE(YEAR(B$1),1,0)),0),
        IFERROR(
        GETPIVOTDATA("Child ID",'Child Numbers 2013'!$A$1,"Venue",$A4,"Age group","6/7 years","Activity","ISS","date",B$1-DATE(YEAR(B$1),1,0)),0),
        IFERROR(
        GETPIVOTDATA("Child ID",'Child Numbers 2013'!$A$1,"Venue",$A4,"Age group","8 + years","Activity","ISS","date",B$1-DATE(YEAR(B$1),1,0)),0),

        IFERROR(
        GETPIVOTDATA("Child ID",'Child Numbers 2013'!$A$1,"Venue",$A4,"Age group","4/5 years","Activity","MVC","date",B$1-DATE(YEAR(B$1),1,0)),0),
        IFERROR(
        GETPIVOTDATA("Child ID",'Child Numbers 2013'!$A$1,"Venue",$A4,"Age group","6/7 years","Activity","MVC","date",B$1-DATE(YEAR(B$1),1,0)),0),
        IFERROR(
        GETPIVOTDATA("Child ID",'Child Numbers 2013'!$A$1,"Venue",$A4,"Age group","8 + years","Activity","MVC","date",B$1-DATE(YEAR(B$1),1,0)),0)
    ),

 SUM(
        IF(
            OR(
                IFERROR(
                GETPIVOTDATA("Child ID",'Child Numbers 2013'!$A$1,"Venue",$A4,"Age group","4/5 years","Activity","Multi-Active","date",B$1-DATE(YEAR(B$1),1,0)),0),
                IFERROR(
                GETPIVOTDATA("Child ID",'Child Numbers 2013'!$A$1,"Venue",$A4,"Age group","6/7 years","Activity","Multi-Active","date",B$1-DATE(YEAR(B$1),1,0)),0),
                IFERROR(
                GETPIVOTDATA("Child ID",'Child Numbers 2013'!$A$1,"Venue",$A4,"Age group","8 + years","Activity","Multi-Active","date",B$1-DATE(YEAR(B$1),1,0)),0)
            ),
                SUM(
                    (
                    (IFERROR(GETPIVOTDATA("Child ID",'Child Numbers 2013'!$A$1,"Venue",$A4,"Age group","4/5 years","Activity","Multi-Active","date",B$1-DATE(YEAR(B$1),1,0)),0)+($B$49-MOD(IFERROR(GETPIVOTDATA("Child ID",'Child Numbers 2013'!$A$1,"Venue",$A4,"Age group","4/5 years","Activity","Multi-Active","date",B$1-DATE(YEAR(B$1),1,0)),0),$B$49)))/$B$49
                    )
                    +
                    (
                    ((IFERROR(GETPIVOTDATA("Child ID",'Child Numbers 2013'!$A$1,"Venue",$A4,"Age group","6/7 years","Activity","Multi-Active","date",B$1-DATE(YEAR(B$1),1,0)),0)-($B$49-MOD(IFERROR(GETPIVOTDATA("Child ID",'Child Numbers 2013'!$A$1,"Venue",$A4,"Age group","4/5 years","Activity","Multi-Active","date",B$1-DATE(YEAR(B$1),1,0)),0),$B$49)))+($B$50-(MOD((IFERROR(GETPIVOTDATA("Child ID",'Child Numbers 2013'!$A$1,"Venue",$A4,"Age group","6/7 years","Activity","Multi-Active","date",B$1-DATE(YEAR(B$1),1,0)),0)-($B$49-MOD(IFERROR(GETPIVOTDATA("Child ID",'Child Numbers 2013'!$A$1,"Venue",$A4,"Age group","4/5 years","Activity","Multi-Active","date",B$1-DATE(YEAR(B$1),1,0)),0),$B$49))),$B$50))))/$B$50
                    )
                    +
                    (
                    CEILING(
                        IF(
                            ((IFERROR(GETPIVOTDATA("Child ID",'Child Numbers 2013'!$A$1,"Venue",$A4,"Age group","8 + years","Activity","Multi-Active","date",B$1-DATE(YEAR(B$1),1,0)),0)-($B$50-(MOD((IFERROR(GETPIVOTDATA("Child ID",'Child Numbers 2013'!$A$1,"Venue",$A4,"Age group","6/7 years","Activity","Multi-Active","date",B$1-DATE(YEAR(B$1),1,0)),0)-($B$49-MOD(IFERROR(GETPIVOTDATA("Child ID",'Child Numbers 2013'!$A$1,"Venue",$A4,"Age group","4/5 years","Activity","Multi-Active","date",B$1-DATE(YEAR(B$1),1,0)),0),$B$49))),$B$50))))/$B$51)<0,
                            0,
                            (
                            (IFERROR(GETPIVOTDATA("Child ID",'Child Numbers 2013'!$A$1,"Venue",$A4,"Age group","8 + years","Activity","Multi-Active","date",B$1-DATE(YEAR(B$1),1,0)),0)-($B$50-(MOD((IFERROR(GETPIVOTDATA("Child ID",'Child Numbers 2013'!$A$1,"Venue",$A4,"Age group","6/7 years","Activity","Multi-Active","date",B$1-DATE(YEAR(B$1),1,0)),0)-($B$49-MOD(IFERROR(GETPIVOTDATA("Child ID",'Child Numbers 2013'!$A$1,"Venue",$A4,"Age group","4/5 years","Activity","Multi-Active","date",B$1-DATE(YEAR(B$1),1,0)),0),$B$49))),$B$50))))/$B$51
                            )
                        ),1
                    )
                    )
                )
                ,
                0
        )
        +

        IF(
            OR(
                IFERROR(
                GETPIVOTDATA("Child ID",'Child Numbers 2013'!$A$1,"Venue",$A4,"Age group","4/5 years","Activity","ISS","date",B$1-DATE(YEAR(B$1),1,0)),0),
                IFERROR(
                GETPIVOTDATA("Child ID",'Child Numbers 2013'!$A$1,"Venue",$A4,"Age group","6/7 years","Activity","ISS","date",B$1-DATE(YEAR(B$1),1,0)),0),
                IFERROR(
                GETPIVOTDATA("Child ID",'Child Numbers 2013'!$A$1,"Venue",$A4,"Age group","8 + years","Activity","ISS","date",B$1-DATE(YEAR(B$1),1,0)),0)
            ),      
            SUM(
                (
                (IFERROR(GETPIVOTDATA("Child ID",'Child Numbers 2013'!$A$1,"Venue",$A4,"Age group","4/5 years","Activity","ISS","date",B$1-DATE(YEAR(B$1),1,0)),0)+($B$49-MOD(IFERROR(GETPIVOTDATA("Child ID",'Child Numbers 2013'!$A$1,"Venue",$A4,"Age group","4/5 years","Activity","ISS","date",B$1-DATE(YEAR(B$1),1,0)),0),$B$49)))/$B$49
                )
                +
                (
                ((IFERROR(GETPIVOTDATA("Child ID",'Child Numbers 2013'!$A$1,"Venue",$A4,"Age group","6/7 years","Activity","ISS","date",B$1-DATE(YEAR(B$1),1,0)),0)-($B$49-MOD(IFERROR(GETPIVOTDATA("Child ID",'Child Numbers 2013'!$A$1,"Venue",$A4,"Age group","4/5 years","Activity","ISS","date",B$1-DATE(YEAR(B$1),1,0)),0),$B$49)))+($B$50-(MOD((IFERROR(GETPIVOTDATA("Child ID",'Child Numbers 2013'!$A$1,"Venue",$A4,"Age group","6/7 years","Activity","ISS","date",B$1-DATE(YEAR(B$1),1,0)),0)-($B$49-MOD(IFERROR(GETPIVOTDATA("Child ID",'Child Numbers 2013'!$A$1,"Venue",$A4,"Age group","4/5 years","Activity","ISS","date",B$1-DATE(YEAR(B$1),1,0)),0),$B$49))),$B$50))))/$B$50
                )
                +
                (
                    CEILING(
                    IF(
                    ((IFERROR(GETPIVOTDATA("Child ID",'Child Numbers 2013'!$A$1,"Venue",$A4,"Age group","8 + years","Activity","ISS","date",B$1-DATE(YEAR(B$1),1,0)),0)-($B$50-(MOD((IFERROR(GETPIVOTDATA("Child ID",'Child Numbers 2013'!$A$1,"Venue",$A4,"Age group","6/7 years","Activity","ISS","date",B$1-DATE(YEAR(B$1),1,0)),0)-($B$49-MOD(IFERROR(GETPIVOTDATA("Child ID",'Child Numbers 2013'!$A$1,"Venue",$A4,"Age group","4/5 years","Activity","ISS","date",B$1-DATE(YEAR(B$1),1,0)),0),$B$49))),$B$50))))/$B$51)<0,
                    0,
                    (
                    (IFERROR(GETPIVOTDATA("Child ID",'Child Numbers 2013'!$A$1,"Venue",$A4,"Age group","8 + years","Activity","ISS","date",B$1-DATE(YEAR(B$1),1,0)),0)-($B$50-(MOD((IFERROR(GETPIVOTDATA("Child ID",'Child Numbers 2013'!$A$1,"Venue",$A4,"Age group","6/7 years","Activity","ISS","date",B$1-DATE(YEAR(B$1),1,0)),0)-($B$49-MOD(IFERROR(GETPIVOTDATA("Child ID",'Child Numbers 2013'!$A$1,"Venue",$A4,"Age group","4/5 years","Activity","ISS","date",B$1-DATE(YEAR(B$1),1,0)),0),$B$49))),$B$50))))/$B$51
                    )
                    ),1
                    )
                )
            )
            ,
            0
        )       
        +
        SUM(
                (
                (IFERROR(GETPIVOTDATA("Child ID",'Child Numbers 2013'!$A$1,"Venue",$A4,"Age group","4/5 years","Activity","MVC","date",B$1-DATE(YEAR(B$1),1,0)),0)+($B$49-MOD(IFERROR(GETPIVOTDATA("Child ID",'Child Numbers 2013'!$A$1,"Venue",$A4,"Age group","4/5 years","Activity","MVC","date",B$1-DATE(YEAR(B$1),1,0)),0),$B$49)))/$B$49
                )
                +
                (
                ((IFERROR(GETPIVOTDATA("Child ID",'Child Numbers 2013'!$A$1,"Venue",$A4,"Age group","6/7 years","Activity","MVC","date",B$1-DATE(YEAR(B$1),1,0)),0)-($B$49-MOD(IFERROR(GETPIVOTDATA("Child ID",'Child Numbers 2013'!$A$1,"Venue",$A4,"Age group","4/5 years","Activity","MVC","date",B$1-DATE(YEAR(B$1),1,0)),0),$B$49)))+($B$50-(MOD((IFERROR(GETPIVOTDATA("Child ID",'Child Numbers 2013'!$A$1,"Venue",$A4,"Age group","6/7 years","Activity","MVC","date",B$1-DATE(YEAR(B$1),1,0)),0)-($B$49-MOD(IFERROR(GETPIVOTDATA("Child ID",'Child Numbers 2013'!$A$1,"Venue",$A4,"Age group","4/5 years","Activity","MVC","date",B$1-DATE(YEAR(B$1),1,0)),0),$B$49))),$B$50))))/$B$50
                )
                +
                (
                CEILING(
                        IF(
                         ((IFERROR(GETPIVOTDATA("Child ID",'Child Numbers 2013'!$A$1,"Venue",$A4,"Age group","8 + years","Activity","MVC","date",B$1-DATE(YEAR(B$1),1,0)),0)-($B$50-(MOD((IFERROR(GETPIVOTDATA("Child ID",'Child Numbers 2013'!$A$1,"Venue",$A4,"Age group","6/7 years","Activity","MVC","date",B$1-DATE(YEAR(B$1),1,0)),0)-($B$49-MOD(IFERROR(GETPIVOTDATA("Child ID",'Child Numbers 2013'!$A$1,"Venue",$A4,"Age group","4/5 years","Activity","MVC","date",B$1-DATE(YEAR(B$1),1,0)),0),$B$49))),$B$50))))/$B$51)<0,
                         0,
                         (
                         (IFERROR(GETPIVOTDATA("Child ID",'Child Numbers 2013'!$A$1,"Venue",$A4,"Age group","8 + years","Activity","MVC","date",B$1-DATE(YEAR(B$1),1,0)),0)-($B$50-(MOD((IFERROR(GETPIVOTDATA("Child ID",'Child Numbers 2013'!$A$1,"Venue",$A4,"Age group","6/7 years","Activity","MVC","date",B$1-DATE(YEAR(B$1),1,0)),0)-($B$49-MOD(IFERROR(GETPIVOTDATA("Child ID",'Child Numbers 2013'!$A$1,"Venue",$A4,"Age group","4/5 years","Activity","MVC","date",B$1-DATE(YEAR(B$1),1,0)),0),$B$49))),$B$50))))/$B$51
                         )
                        ),1
                    )
                )
        )       
 ),

 "-"
)
4

1 回答 1

0

定义的名称已经破解了它。仅供参考 - 我已将外部数据透视表的引用重新定义为 CN 而不是全名,这节省了数百个字符。谢谢大家!我已经标记了所有提出这个建议的人。

于 2013-03-12T15:37:34.147 回答