选择与excel中指定编号匹配的列

时间:2016-09-01 18:06:34

标签: excel vba

@echo off
echo Enter '1' to blabla
echo Enter '2' to blabla
echo Enter anything to abort
set /p choice="Type input: "

IF "%choice%"=="1" goto echoto1         

rem enter anything here you want it to do if variable is not met

:echoto1
rem start's here if the variable was met
echo toto1
@echo currentMaster=%ecb%>> MDC.properties
@echo masterDcName=ECBDC>> MDC.properties
@echo currentClone=%bdf%>> MDC.properties
@echo cloneDcName=BDFDC>> MDC.properties

我有一个这样的表,但有更多的列和行。我想根据下面显示的另一张表中的一组数字选择列和行。如果上表中第一行(和第一列)与下表中列出的数字匹配,请选择列(和行)。并将选定的列和行交集的值添加到一起。

HB  1   2   3   4
1   0   0   0   0
2   0   0   0   0
3   0   0   0   0
4   0   0   0   0
5   0   0   0   0
6   0   0   0.1 0
7   0   0   0   0
8   0   0   0   0

如何在excel中实现这一目标?感谢。

1 个答案:

答案 0 :(得分:2)

使用带有MATCH的SUMPRODUCT来指出所需的行和列:

=SUMPRODUCT(ISNUMBER(MATCH($B$1:$X$1,$B$12:$B$15,0))*ISNUMBER(MATCH($A$2:$A$9,$D$12:$D$15,0))*$B$2:$X$9)

enter image description here