简体   繁体   English

在从Excel公式获取特定信息方面需要帮助

[英]Need help on getting specific information from an excel formula

I work for a company that has multiple locations selling auto parts. 我在一家有多个销售汽车零件的公司工作。 I'm wanting to look at the 'freshness' of the inventory, but for a specific year range for specific vehicle(s). 我想查看库存的“新鲜程度”,但特定车辆的特定年份范围内。

The basic formula I'm using is 我正在使用的基本公式是

=COUNTIFS(INVENTORY!$A$2:$A$50000,$B$1,INVENTORY!$I$2:$I$50000,$J$117,INVENTORY!P$2:P$50000,$C$118)

Result is 4 结果是4

The first argument is looking at the location, the second is looking at the particular vehicle. 第一个参数是查看位置,第二个参数是查看特定的车辆。 The third is determining whether the inventory is either 30, 60 or 90 days old, and I'm getting the right information. 第三是确定库存是30天,60天还是90天,我正在获取正确的信息。 What I want to know now is, while looking at those 4 vehicles, how many of those are made between the years 2004 to 2010, so the criteria for the 4th argument has a range within it, not one specific year (I know the result should come back as 1 in either the 30, 60 or 60+ cell). 我现在想知道的是,在查看这4辆汽车时,在2004年至2010年之间有多少辆汽车被制造出来,因此第4个论点的标准在范围之内,而不是一个特定的年份(我知道结果应该在30、60或60+单元格中返回1。 On the inventory sheet, the years of the vehicles are in column 'E'. 在库存表上,车辆的年份在“ E”列中。 I'm not sure if I need to use imbedded IF statements to specify the year range, or need to rewrite the whole formula. 我不确定是否需要使用嵌入式IF语句指定年份范围,还是需要重写整个公式。 Can anyone give me some advise on how to write the formula to get this info? 谁能给我一些关于如何编写公式以获取此信息的建议?

You can add two conditions to your COUTINFS on the same E column for the year, ie 您可以在同一年的E列中将两个条件添加到COUTINFS ,即

=COUNTIFS(INVENTORY!A:A,$B$1,INVENTORY!I:I,$J$117,INVENTORY!P:P,$C$118,
   INVENTORY!E:E, ">=2004", INVENTORY!E:E, "<=2010")

The second line above shows the additional consitions. 上面的第二行显示了其他情况。 If the range of years is dynamically present in cells, say C1 and D1 , the criteria should be composed by concatenation, ie 如果单元格中动态存在年份范围,例如C1D1 ,则标准应由串联组成,即

=COUNTIFS(INVENTORY!A:A,$B$1,INVENTORY!I:I,$J$117,INVENTORY!P:P,$C$118,
   INVENTORY!E:E, ">="&C1, INVENTORY!E:E, "<="&D1)
'                  ^^^^^^                  ^^^^^^

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM