简体   繁体   中英

excel formula to search multiple criteria

So I'm trying to write an excel formula that finds the number of records based on a location. Say I want the number of times A appears for the Nashville location, how would I go about this?

Here's a sample table - obviously simplified as I'm using a very large data source.

 Item  Location 
 A     Nashville
 B    New Orleans  
 B     Nashville
 A     Las Vegas   
 A     Las Vegas
 A     Nashville
 C    New Orleans 
 D     Nashville
 B     Las Vegas

I need the formula to filter the rows to find the ones that use the given location and the item, and count the number of times it appears.

I tried using Vlookup's and if statements, but didn't have any success (I don't want to create a new 'helper column)

Pretty sure I did a very bad job explaining this, let me know if you need clarification..

Don't overthink it! You can just use COUNTIFS() , as mentioned in the comments.

=COUNTIFS($A:$A,"A",$B:$B,"Nashville")

And I would recommend not using whole columns, but rather the specific range (eg ...($A$1:$A$1000) or such.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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