假设我有下表:
<table>
<tr>
<th>product</th>
<th>date</th>
<th>price</th>
</tr>
<tr>
<td>xyz</td>
<td>6/1/2017</td>
<td>11.0</td>
</tr>
<tr>
<td>xyz</td>
<td>6/2/2017</td>
<td>11.2</td>
</tr>
<tr>
<td>xyz</td>
<td>6/3/2017</td>
<td>11.1</td>
</tr>
<tr>
<td>xyz</td>
<td>6/4/2017</td>
<td>11.3</td>
</tr>
<tr>
<td>xyz</td>
<td>6/5/2017</td>
<td>11.3</td>
</tr>
<tr>
<td>abc</td>
<td>6/1/2017</td>
<td>7.5</td>
</tr>
<tr>
<td>abc</td>
<td>6/2/2017</td>
<td>7.5</td>
</tr>
<tr>
<td>abc</td>
<td>6/3/2017</td>
<td>7.5</td>
</tr>
<tr>
<td>abc</td>
<td>6/4/2017</td>
<td>7.6</td>
</tr>
</table>
&#13;
我想生成一个如下所示的表格。可以手动插入“产品”列。但我想要&#34;价格上涨总数&#34;使用Excel公式生成。
<table>
<tr>
<td>Product</td>
<td>Total count of price increase</td>
</tr>
<tr>
<td>xyz</td>
<td>2</td>
</tr>
<tr>
<td>abc</td>
<td>1</td>
</tr>
</table>
&#13;
有可能这样做吗?我尝试使用OFFSet的CountIfs,但我无法弄清楚如何与前一天的价格进行比较。
答案 0 :(得分:1)
如果您的第一张表的数据已按产品排序,则此公式有效。将其输入Sheet2!B2
并填写:
B2:
=SUMPRODUCT((Sheet1!$A$2:$A$100 = A2) * (Sheet1!$A$3:$A$101 = A2)*
(Sheet1!$C$3:$C$101 > Sheet1!$C$2:$C$100))