在VBA中搜索和查找

时间:2015-05-01 17:32:26

标签: excel vba excel-vba search

我需要帮助编写一个在Excel中使用的宏。基本上我正在使用的是大量的财务数据,几乎总是独一无二的。我需要能够将一列(DateTimePicker d1; DateTimePicker d2; public void ComputeDifference() { TimeSpan diff = d2.Value - d1.Value; int days = diff.Days + 1; } )中的每个单元格与另一列(B)进行比较,以搜索匹配值。找到匹配值后,我需要宏将与原始找到的值相关的值打印到搜索值旁边的单元格中。 (列H将具有引用单元格G

的值的标题

基本上我需要能够将列H中每个单元格的单个值与整个列B进行比较,如果匹配,则具有列{{ 1}}显示在列H中原始单元格旁边的列G中。对不起,可怕的解释。

搜索专栏A以获取B的值匹配。如果H,请在B2中打印H30 = B30

2 个答案:

答案 0 :(得分:1)

由于您无法使用- (void)loadView { CGRect mainScreenFrame = [[UIScreen mainScreen] applicationFrame]; GPUImageView *primaryView = [[GPUImageView alloc] initWithFrame:mainScreenFrame]; self.view = primaryView; UIImage *inputImage = [UIImage imageNamed:@"WID-small.jpg"]; GPUImagePicture *sourcePicture = [[GPUImagePicture alloc] initWithImage:inputImage smoothlyScaleOutput:YES]; // Creating another view to show histogram GPUImageView *histView = [[GPUImageView alloc] initWithFrame:CGRectMake(mainScreenFrame.size.width - 100, mainScreenFrame.size.height - 100, 100, 100)]; [primaryView addSubview:histView]; // Create histogram filter and generator and point it to histogram view GPUImageOutput<GPUImageInput> *histFilter = [[GPUImageHistogramFilter alloc] initWithHistogramType:kGPUImageHistogramLuminance]; GPUImageOutput<GPUImageInput> *histGenerator = [[GPUImageHistogramGenerator alloc] init]; [histGenerator forceProcessingAtSize:histView.sizeInPixels]; [sourcePicture addTarget:histFilter]; [histFilter addTarget:histGenerator]; // Note target - hist view [histGenerator addTarget:histView]; // Setup sepia filter just to show main picture GPUImageOutput<GPUImageInput> *sepiaFilter = [[GPUImageSepiaFilter alloc] init]; [sepiaFilter forceProcessingAtSize:primaryView.sizeInPixels]; [sourcePicture addTarget:sepiaFilter]; // Note target - main view [sepiaFilter addTarget:primaryView]; [sourcePicture processImage]; } ,因此您需要使用嵌套的VLOOKUP()MATCH()

INDEX()

供参考:

答案 1 :(得分:0)

您很可能不需要宏。尝试VLOOKUP功能:https://support.office.com/en-in/article/VLOOKUP-function-adceda66-30de-4f26-923b-7257939faa65

编辑: 语法应该是这样的:

=VLOOKUP(B1, G:H, 2, FALSE)

然后根据您的电子表格填写并调整绝对参考。