我正在尝试改进我继承的复杂查找过程。查找是通过几个UDF与一些标准工作表函数结合生成的。但是,问题是当用户更新源表中的某些数据时,重新计算时间是不可接受的。复杂查找更好的Excel公式
所以,我看了一下,并认为我可能会写一个更好的Excel公式唯一的解决方案。那么,我确实找到了一个解决方案,但Excel对于大型数据集处理太多了,而且当我的VBA针对数据集运行公式时,它崩溃了(可以理解!)。
现在,我可以在VBA中完全实现此功能,但用户在每次更改后都必须按下某个按钮或某个按钮来更新。我想要的是更简单的方法,如果有的话,使用一些高级的Excel 2007公式。由于我对这些公式不太熟悉,因此我正在寻求帮助!
好的,这是我必须与之合作。
SourceSheet
TID的,结算日期,及月底价格(由1,2,3-识别层段,等)在列象下面
Tid SettleDate 1 2 3 4 5 6 7 8 9 10 ... n
FormulaSheet
在其他列中,我有以下列
InitLayer LiqdLayer InstrClass Tid SettleDate InitPrice LiqdPrice Position
我也有在列的层数到整个数据集的权利,就像这样:
1 2 3 4 5 ... n
我需要做基于一些逻辑填补这些列中的适当的价格变化在数据集中查找源表单上的价格。
在伪公式,这就是我需要在FormulaSheet
If Layer < InitLayer OR Layer > LiqdLayer Then Return "-"
ElseIf Layer = InitLayer Then (Layered Price - InitPrice) * Position
where Layered Price is obtained by finding the Intersect of the LayerNumber
Column and Tid Row in the SourceSheet
ElseIf Layer = LiqdLayer Then Previous Layered Price * Position
where Previous Layered Price is obtained by finding the Intersect of the Previous
LayerNumber Column and Tid Row in the SourceSheet
Else (LayeredPrice - Previous Layered Price) * 6
where Layered Price and Previous Layered Price are defined as above
End If
我没有想出这个公式,对小数据集行之有效发生每层列,但其toooooooooo对于大型数据集来说太大而且讨厌,或者太大而且讨厌的时期!
=IF(OR(CH$3<$AT6,CH$3>$AU6),"-",IF($AT6=CH$3,(HLOOKUP(CH$3,layered_prices,RIGHT(ADDRESS(MATCH(IF($AX6="CUR",$T6 & " " & $G6,$T6),IF($AX6="CUR",layered_curtid,layered_tid),1),1,4),LEN(ADDRESS(MATCH(IF($AX6="CUR",$T6 & " " & $G6,$T6),IF($AX6="CUR",layered_curtid,layered_tid),1),1,4))-1)-1,FALSE)-$AV6)*$C6,IF($AU6=CH$3,($AW6-HLOOKUP(CG$3,layered_prices,RIGHT(ADDRESS(MATCH(IF($AX6="CUR",$T6 & " " & $G6,$T6),IF($AX6="CUR",layered_curtid,layered_tid),1),1,4),LEN(ADDRESS(MATCH(IF($AX6="CUR",$T6 & " " & $G6,$T6),IF($AX6="CUR",layered_curtid,layered_tid),1),1,4))-1)-1,FALSE))*$C6,(HLOOKUP(CH$3,layered_prices,RIGHT(ADDRESS(MATCH(IF($AX6="CUR",$T6 & " " & $G6,$T6),IF($AX6="CUR",layered_curtid,layered_tid),1),1,4),LEN(ADDRESS(MATCH(IF($AX6="CUR",$T6 & " " & $G6,$T6),IF($AX6="CUR",layered_curtid,layered_tid),1),1,4))-1)-1,FALSE)-HLOOKUP(CG$3,layered_prices,RIGHT(ADDRESS(MATCH(IF($AX6="CUR",$T6 & " " & $G6,$T6),IF($AX6="CUR",layered_curtid,layered_tid),1),1,4),LEN(ADDRESS(MATCH(IF($AX6="CUR",$T6 & " " & $G6,$T6),IF($AX6="CUR",layered_curtid,layered_tid),1),1,4))-1)-1,FALSE))*$C6)))
公式键
CH = Layer Number
CG = Previous Layer Number
AT = InitLayer
AU = LiqdLayer
AX = InstrClass (used to find a separate lookup for Currencies)
T = Tid
G = SettleDate (used to find a separate lookup for Currencies)
AV = InitPrice
AW = LiqPrice
C = Position
layered_prices = named range for the range of prices under the layer columns in SourceSheet
layered_tid = named range for tid rows in SourceSheet
layered_curtid = named range for currency tid rows in Source Sheet (just a separte lookup if InstrType = Currency, formula the same
是否有我所创建的其他公式或公式,让我得到我在一个更有效的方式比怪物正在寻求的组合?
数据集有多大?如果它超过20万行,它可能不可能作为一个公式...... – bendataclear
虽然我们可能在少数情况下达到这个数字,但大多数情况下不会达到这个数字。我一直在探索查找和参考部分,我可能会找到一些东西......如果我找到更好的答案,就会发布。 –
很难想象这个问题,是否可以发布/链接到少量的示例数据/。 – bendataclear