如何使用 VBA 从重复项中水平返回查找值 [图片] [英] How to horizontally return looked up values from duplicates w VBA [pic]

查看:24
本文介绍了如何使用 VBA 从重复项中水平返回查找值 [图片]的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

见相关图片.我正在尝试返回与数组中重复单元格对应的值 ==> 水平.因此,查找的第一个实例在 E 列中,第二个实例在 F 列中,第三个在 G 中;等等.我可以用这个小数据的数组公式来做到这一点:

See pic related. I'm trying to return values corresponding to duplicate cells in an array ==>horizontally. So the first instance of a lookup goes in Column E, the second instance in Column F, third in G; and so-on. I can do that with an array formula for this small bit of data:

重复数组公式

但这就是问题所在.

使用 5、10 或 15,000 多行的数组公式需要相当长的时间.是否有 VBA 解决方案可以按列返回与数组中重复单元格对应的值?

Using array formulas for 5, 10, or 15,000+ rows takes quite a bit of time. Is there a VBA solution to return values corresponding to duplicate cells in an array by columns?

推荐答案

我确信有非常高性能的 VBA 解决方案,但为什么不跳过所有这些并在数据透视表中执行它?

I'm sure there are very performant VBA solutions, but why not just skip all that and do it in a pivot table?

给定您的数据:

其中附加字段第 1 列"是根据公式构建的

where the additional field 'Column 1' is built from the formula

="Payment_" & COUNTIF($A$2:A2,A2)

总结为数据透视表"很简单:

It's a snap to "summarize as pivot table" to this:

这篇关于如何使用 VBA 从重复项中水平返回查找值 [图片]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆