SOLVED

Finding count of item between number ranges between two tables

Copper Contributor

Hi. 

 

I have two tables, one has unique rows and the other has multiple rows.

 

The unique Rows table  has a SCAC column, four columns of details (AAR Mech, Length interior, Length exterior, and Doors), Range from, Range to, Cu Ft, and count.   This table is updated as I download traffic reports that have been scanned and uploaded to a website.  

 

The multiple rows table is in a different tab and has an equipment roster containing the SCAC, Car # and additional information such as manufacturer, car type, cu ft, color, Brand, and Model #.   Each row is unique in the car number but most of the other columns have the same information between rows such as Manufacturer and car type. 

 

What I am trying to do is get a count of cars that are in the equipment roster having a # that falls within the number range from and range to for each unique row.   I want to know for each unique row, example BCIT with number range from 841100 to 841599, how many cars in the equipment roster table fall within 841100 to 841599.    BCIT 841100 to 841599 shows up 12 times in the traffic reports so if there are none in the equipment roster I know I need to look for those cars.  If for example, CFPX range 4627 to 4686 shows 3 times in the traffic report and I have two cars, 4627 and 4639 that I do not need to purchase any more CFPX cars. 

 

I went through multiple searches and results were lookup, countifs, vlookups, and indexes and could not find any that would do what I am trying to do.

 

I think the information I have given is straight forward but if I need to attach example files let me know.  thanks

 

Michael

 

2 Replies
best response confirmed by allyreckerman (Microsoft)
Solution

@t would have been helpful if you had a sample file with perhaps a dozen rows and the desired results from the formula.

 

Based on my understanding of the question, you are probably wanting a COUNTIFS formula that matches the SCAC and counts the number of rows where the car # is within the from and to range.

 

In my test workbook, I named the worksheets UniqueRows and EquipmentList. UniqueRows column A is SCAC, column F is the From and column G is the To. EquipmentList column A is SCAC and column B is the car #.

 

I put the following formula in UniqueRows cell I2 and copied it down.

 

=COUNTIFS(EquipmentList!A:A,A2,EquipmentList!B:B,">=" & F2,EquipmentList!B:B,"<=" & G2)

 

@byundt That worked perfect.  Thank you.  I am getting too old for Excel..lol.

1 best response

Accepted Solutions
best response confirmed by allyreckerman (Microsoft)
Solution

@t would have been helpful if you had a sample file with perhaps a dozen rows and the desired results from the formula.

 

Based on my understanding of the question, you are probably wanting a COUNTIFS formula that matches the SCAC and counts the number of rows where the car # is within the from and to range.

 

In my test workbook, I named the worksheets UniqueRows and EquipmentList. UniqueRows column A is SCAC, column F is the From and column G is the To. EquipmentList column A is SCAC and column B is the car #.

 

I put the following formula in UniqueRows cell I2 and copied it down.

 

=COUNTIFS(EquipmentList!A:A,A2,EquipmentList!B:B,">=" & F2,EquipmentList!B:B,"<=" & G2)

 

View solution in original post