excel我需要列名“FEBRUARY”的公式

时间:2015-02-03 04:59:49

标签: excel excel-formula formula

我有一组数据如下。

第1页

                +------+-------+
                |    JANUARY   |
                +------+-------+
+----+----------+------+-------+
| ID | NAME     |COUNT | PRICE |
+----+----------+------+-------+
| 1  |  ALFRED  |  11  |  150  |
| 2  |  ARIS    |  22  |  120  |
| 3  |  JOHN    |  33  |  170  |
| 4  |  CHRIS   |  22  |  190  |
| 5  |  JOE     |  55  |  120  |
| 6  |  ACE     |  11  |  200  |
+----+----------+------+-------+

SHEET2

+----+----------+------+-------+
| ID | NAME     |COUNT | PRICE |
+----+----------+------+-------+
| 1  |  CHRIS   |  13  |  123  |
| 2  |  ACE     |  26  |  165  |
| 3  |  JOE     |  39  |  178  |
| 4  |  ALFRED  |  21  |  198  |
| 5  |  JOHN    |  58  |  112  |
| 6  |  ARIS    |  11  |  200  |
+----+----------+------+-------+

结果在sheet1中应如下所示:

                +------+-------++------+-------+
                |    JANUARY   |   FEBRUARY    |
                +------+-------++------+-------+
+----+----------+------+-------++-------+-------+
| ID | NAME     |COUNT | PRICE || COUNT | PRICE |
+----+----------+------+-------++-------+-------+
| 1  |  ALFRED  |  11  |  150  ||  21   |  198  |       
| 2  |  ARIS    |  22  |  120  ||  11   |  200  |       
| 3  |  JOHN    |  33  |  170  ||  58   |  112  |       
| 4  |  CHRIS   |  22  |  190  ||  13   |  123  |       
| 5  |  JOE     |  55  |  120  ||  39   |  178  |       
| 6  |  ACE     |  11  |  200  ||  26   |  165  |         
+----+----------+------+-------++-------+-------+

我需要列名称中的公式" FEBRUARY"。这个公式将在表2中找到它的匹配

2 个答案:

答案 0 :(得分:1)

假设第一个Count值应该在Sheet1的单元格E3中,下面的公式将是通常的方法: -

=INDEX(Sheet2!C:C,MATCH($B3,Sheet2!$B:$B,0))

然后价格(在F3中)将由

给出
=INDEX(Sheet2!D:D,MATCH($B3,Sheet2!$B:$B,0))

答案 1 :(得分:0)

我认为此查询可以满足您的要求

SELECT `Sheet1$`.ID,`Sheet1$`.NAME, `Sheet1$`.COUNT AS 'Jan-COUNT',`Sheet1$`.PRICE AS 'Jan-PRICE', `Sheet2$`.COUNT AS 'Feb-COUNT',`Sheet2$`.PRICE AS 'Feb-PRICE'
FROM `C:\Users\Nagendra\Desktop\aaaaa.xlsx`.`Sheet1$` `Sheet1$`, `C:\Users\Nagendra\Desktop\aaaaa.xlsx`.`Sheet2$` `Sheet2$`
WHERE (`Sheet1$`.NAME=`Sheet2$`.NAME)

提供

的实际路径
C:\Users\Nagendra\Desktop\aaaaa.xlsx

首先,您需要了解如何建立连接。请参阅http://smallbusiness.chron.com/use-sql-statements-ms-excel-41193.html