Count the number of matching text strings between 2 tables with multiple criteria

Sketchin

New Member
Joined
Oct 21, 2013
Messages
11
Hey all,

I have a table that contains a list of reservations and a table that contains a list of "BOMS" (bill of materials). I would like to count the number of times a BOM shows up in the reservation table in a specific fiscal year.

An example of each table:

BOMIDFY2010FY2011
110
110
2001
2510

<tbody>
</tbody>

Based on a reporting date of FY2010.

BOMIDBOM Description Count
1Item 12
20Item 20
25Item 3 1

<tbody>
</tbody>

The "Count" column is the one that would contain the equation that I am looking for. The equation I currently have is like this:

=COUNTIFS(AllReservationsFiscal[BOMID],[BOMID],(INDIRECT("AllReservationsFiscal[FY"&$B$1&"]")),(INDIRECT("AllReservationsFiscal[FY"&$B$1&"]"))>0)

This returns a value of 0. This - [FY"&$B$1&"] - is a string that refers to my reporting date. In my example above, B1 = 2010.

Please let me know if you need more information.
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
Hi Sketchin,

with these two tables in sheet 1 and sheet 2, use below formula in C2 of sheet 2:-

=SUMPRODUCT((Sheet1!$A$2:$A$5=Sheet2!$A2)*(Sheet1!$B$1:$C$1=Sheet2!C$1)*(Sheet1!$B$2:$C$5))

and drag down the formula.

C1 contains the heading as FY2010


Regards,
DILIPandey
 
Upvote 0
Hi Sketchin,

with these two tables in sheet 1 and sheet 2, use below formula in C2 of sheet 2:-

=SUMPRODUCT((Sheet1!$A$2:$A$5=Sheet2!$A2)*(Sheet1!$B$1:$C$1=Sheet2!C$1)*(Sheet1!$B$2:$C$5))

and drag down the formula.

C1 contains the heading as FY2010


Regards,
DILIPandey


I think Im close. This is what I now have:

=SUMPRODUCT((AllReservationsFiscal[BOMID]=$GG14)*((INDIRECT("AllReservationsFiscal[FY"&$B$1&"]"))=$C$1)*(INDIRECT("AllReservationsFiscal[FY"&$B$1&"]")))

This returns 0 in a column called FY2016. I think the problem is in this equation:

(INDIRECT("AllReservationsFiscal[FY"&$B$1&"]"))=$C$1).

If I highlight it and press F9, it returns an array of "False"'s.
 
Upvote 0
So I changed the equation to this:

=SUMPRODUCT((AllReservationsFiscal[BOMID]=$GG14)*(AllReservationsFiscal[[#Headers],[FY2009]:[FY2031]]=$C$1)*(INDIRECT("AllReservationsFiscal[FY"&$B$1&"]")))

and now I get the total times that each BOMID shows up in the first table in ANY fiscal year. If I evaluate this:

AllReservationsFiscal[[#Headers],[FY2009]:[FY2031]], I get {False,False,False,False,False,False,False,TRUE,False,False,False,False,False, etc.......}
 
Upvote 0
Hi Sketchin,

can you show up the sample data where this formula is getting failed ?


Regards,
DILIPandey
 
Upvote 0

Forum statistics

Threads
1,216,192
Messages
6,129,443
Members
449,509
Latest member
ajbooisen

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top