使用vba宏搜索具有两个搜索词(多个查找)的excel [英] Searching an excel with two search words (multiple lookup) using vba macro

查看:461
本文介绍了使用vba宏搜索具有两个搜索词(多个查找)的excel的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用vba宏。

任务:

1)用户将给出两个输入。销售的设备数量(B列)和周数(A列)。

2)使用这两个文件搜索excel文件并获得收入。


(条件:
1.我们不必修改excel文件中的任何内容。
2.我们必须首先搜索销售的设备,然后我们可以去周号。)


注意:其实我有一个不同的问题,这是一般的。


我使用找到功能,但我不明白为什么它的工作。



请告诉要做什么



考虑输入是 11 第3周(所以搜索 11 ,然后检查它是否对应于第3周,否则移动到下一个我尝试过,但最终在无限循环中。)

I am using vba macros.
Task:
1) User will give two inputs viz. number of devices sold (column B) and week number (column A).
2) Search the excel file using these two and get the earnings.

(Conditions:
1. We dont have to modify anything in the excel file.
2.And we have to first search devices sold and then we can go to week number.)

Note: Actually i have a different problem, this is generalization for that.

I used find function but I dont understand why its working.

Please tell what is to be done.


Consider the input is 11 and week 3 (so search for 11 and then check if its corresponds to week 3 or not. If not, move to next. I tried this but ended up in an infinite loop.)


推荐答案

你正在寻找一个查找与多iple标准。快速搜索提供了几个有用的链接,如下所列。我已经标记了*我已经回答的那些。
我已经滤除了实际处理其他问题的一些链接。

You are looking for a Lookup with multiple criteria. A quick search gives several useful links, listed below. I have marked with * those that I have answered. I have filtered out some of the links that actually deal with other issues.

如链接中所示,有几个选项实现你的目标我个人更喜欢那些不需要数组公式,使用问题1的答案与 LOOKUP 问题2的答案与 SUMPRODUCT

As seen in the links, there are several options to achieve your goal. I personally prefer those that do not need array formulas, using an answer to question 1 with LOOKUP or an answer to question 2 with SUMPRODUCT.

由于您提到需要VBA解决方案,您可以使用 WorksheetFunction 在VBA代码中使用Excel公式,或检查问题7的答案。

Since you mentioned that you need a VBA solution, you can use WorksheetFunction to use an Excel formula in VBA code, or check answers to question 7.


  1. 多列与多列查询

Excel中的多列查找 *

查找数据库(多重条件)

具有多个查询的Excel查询

多个VLOOKUP LOOKUP IF声明?

如果三列匹配,则返回值excel *

VLookup多列

http://spreadsheets.about.com/b/2014/01/08/excel-lookup-formula-using-multiple-criteria.htm

http:// fiveminuteles sons.com/learn-microsoft-excel/use-index-lookup-multiple-values-list

http://blogs.office.com/2012/04/ 26 / using-multiple-criteria-in-excel-lookup-formula /

http://www.xl-central.com/lookup-multiple-criteria.html

http://www.get-digital-help.com/2012/05/22/lookup-multiple-values-in-different-columns-and- return-a-single-value /

PS:(可能是部分的) )上面提供的重复问题显示了在 https://meta.stackexchange.com/questions/211366/group-duplicate-questions-for-convenience

PS: The (probably partial) list of (probably) duplicated questions provided above shows the usefulness of what was proposed in https://meta.stackexchange.com/questions/211366/group-duplicate-questions-for-convenience

这篇关于使用vba宏搜索具有两个搜索词(多个查找)的excel的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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