Excel数据透视表中的相关性

我有大量的数据,我必须在Excel中进行分析(这在数据库中会更容易,我意识到)。 每个订单项都有一个T / F指标,用于指定类别的成员资格,我希望在几个月内获得每个类别的数量和价格的相关性。 我所说的数据量一次是在8-30万条logging之间。 我们在我的办公室使用Excel 2010

示例数据:

State | Cat.1 | Cat.2 | Cat.3 | TimeStamp | Volume | Price WA | TRUE | FALSE | FALSE | 01/31/13 12:00 | 113.1 | 35.64 WA | TRUE | TRUE | FALSE | 01/31/13 13:00 | 65.2 | 32.52 FL | TRUE | FALSE | TRUE | 01/31/13 02:00 | 78.9 | 36.37 FL | TRUE | TRUE | FALSE | 01/31/13 23:00 | 113.9 | 39.39 

理想情况下,我想要的是一个数据透视表,将关联一个给定的状态,Cat.1,Year和Month组合的数量和价格。

现在我有一个计算字段公式:= correl(卷,价格)但是,该字段返回#DIV / 0为每个scheme,但如果我双击查看适用的数据,我可以手动执行correl()工作正常。

任何帮助都感激不尽!

不知道我是否完全理解了你的问题,但是这听起来像是你想根据你其他一些列的值来进行关联。 因此,我假设如果您在标题行上使用自动筛选器,并且可以筛选所需的状态和类别,则可以将可见值关联起来。 您可能需要两个额外的列= MONTH()和= YEAR()与时间戳。

下面我写的UDF将只关联可见的列,所以去VBA编辑器(Alt F11)并复制这个,然后在下面input公式并过滤你的列

 =CorrelVisibleCells(F1:F100,G1:G100) 

假设F和G是你的数量和价格栏

 Public Function CorrelVisibleCells(aRange1 As Range, aRange2 As Range) Dim aCorrelRange1() Dim aCorrelRange2() Dim rc As Long Dim clCount As Long Application.Volatile True 'This is a volatile function as changing the filter state without changing the cell reference requires a recalc rc = aRange1.Rows.Count ReDim aCorrelRange1(rc) 'Largest they could be, will crop at the end ReDim aCorrelRange2(rc) clCount = 0 For i = 1 To rc If Not aRange1.Cells(i).EntireRow.Hidden Then ' Can't use SpecialCells(xlCellTypeVisible) in a UDF aCorrelRange1(clCount) = aRange1.Cells(i).Value aCorrelRange2(clCount) = aRange2.Cells(i).Value clCount = clCount + 1 End If Next ReDim Preserve aCorrelRange1(clCount - 1) ReDim Preserve aCorrelRange2(clCount - 1) CorrelVisibleCells = WorksheetFunction.Correl(aCorrelRange1, aCorrelRange2) 'Get Excel to do the correlation on our new arrays End Function