问题描述
我有两本Excel单词本.一个在某些日期更改参数,而另一个在果汁生成日期更改.像这样
I have two excel wordbooks. One has parameter changes on certain dates and the other has dates on which the juice has been produced. Like this
电子表格1
date of parameter change %apples %oranges
30/09/2014 55 45
25/09/2014 50 50
20/09/2014 45 55
电子表格2
date of the created juice %people that liked it %apples %oranges
26/09/2014 88
22/09/2014 91
我想将苹果和橙子的%参数复制到第二个工作簿中,以使结果看起来像
And I want to copy the % parameters of apples and oranges into the second workbook so that the result looks like
date of the created juice %people that liked it %apples %oranges
26/09/2014 88 50 50
22/09/2014 91 45 55
因此,基本上,例如,如果果汁是在26/09上制成的,那么我想拥有用于该果汁的参数.显然,没有使用30/09的参数,但使用了25/09的参数,因为它是在果汁制成之前的一天.
So basically if a juice is made on 26/09 for example then I want to have the parameters that were used for that juice. Obviously the parameters of 30/09 weren't used but the parameters of 25/09 were used because it's the day before the juice has been made.
是否可以使用VBA创建类似的内容?有人可以告诉我至少如何进行日期搜索吗?非常感谢!
Is it possible to create something like this with VBA? Could anyone show me how to do the date searching part at least? It would be so much appreciated!
推荐答案
您可以将 VLOOKUP
公式用于您要执行的操作,而不是使用VBA.
You can use a VLOOKUP
formula for what you would like to do rather than using VBA.
VLOOKUP
的语法如下:
VLOOKUP(lookup_value,table_array,col_index_num,[range_lookup])
要找到与您要查找的值的近似匹配,可以将 range_lookup
参数设置为 TRUE
To find an approximate match to the value that you are looking for, you can set the range_lookup
parameter to TRUE
这篇关于是否可以编写一个VBA代码来搜索完全相同的数据或过去最接近的数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!