简体   繁体   English

使用excel VBA查找单元格值,并基于该单元格返回多个值

[英]Using excel VBA to lookup cell value, and return multiple values based on that cell

Sorry for the terrible title, I didn't know how to summarise my problem. 对不起,标题太糟糕了,我不知道该如何总结我的问题。

I have a worksheet with a bunch of payments. 我有一张有很多付款的工作表。 Each payment is made to an ID number. 每次付款都使用一个ID号。 I have another worksheet with the ID numbers and their breakdown; 我还有另一个工作表,其中包含ID号及其分类。 the percentage of the payment that should be allocated to each pot. 应该分配给每个彩池的付款百分比。

eg 例如

Client XYZ ,100 payment in worksheet one, has ID 123.

worksheet 2 has, 工作表2有

123 | A | 5%
 23 | B | 95%  and so on

I would like to be able to produce a third worksheet of the form. 我希望能够生成该表格的第三个工作表。

XYZ, 123, A, $5
XYZ, 123, B, $95

So each payment is multiplied by its breakdown and displayed on another sheet along with the rest of the clients info in the adjoining columns. 因此,每笔付款都将与其细分相乘,并在旁边的列中与其他客户信息一起显示在另一张纸上。

Even just a start on this would be very helpful. 即使只是一个开始也将非常有帮助。 Many thanks. 非常感谢。

From reading your question it seems you just want to perform a simple lookup. 通过阅读您的问题,您似乎只想执行简单的查找。

If you don't need to use VBA, you can do this easily using excel's VLOOKUP function . 如果您不需要使用VBA,则可以使用excel的VLOOKUP函数轻松地做到这一点。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM