SUMPRODUCT to count matches using MID for certain placeholders?

Bob McCusker

New Member
Joined
Oct 24, 2009
Messages
42
Yikes.

I have 3 columns (A, B, & C) displaying data in text format; all values look like 00.00, 2 numbers+period+2 numbers.

I am using the following formula in column D, to count instances where the values of A, B, & C from that row down match the current row's particular combination:

=SUMPRODUCT(--(A2:A1000=A2),--(B2:B1000=B2),--(C2:C1000=C2))

I am now trying to make a formula in column E to do the same thing, except this time it should only use the first 2 characters to match. So instead of counting things matching 03.01*01.01*02.04, it would count things matching just 03*01*02.

The best I could come up with after an hour and a half of searching is this:

=SUMPRODUCT(--(MID(A2,1,2):MID(A1000,1,2)=MID(A2,1,2)),--(MID(B2,1,2):MID(B1000,1,2)=MID(B2,1,2)),
--(MID(C2,1,2):MID(C1000,1,2)=MID(C2,1,2)))

which doesn't seem to work at all. I don't know if I am just off a couple parentheses or quotes, or if my approach is flat out wrong.

Any help would be greatly appreciated. Thanks!
 
Last edited:

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
I am sure that someone will be able to improve on this

=SUMPRODUCT(--(MID(A2:A1000,1,2)="02"))*SUMPRODUCT(--(MID(A2:A1000,1,2)="03")) etc etc


edvwvw
 
Last edited:
Upvote 0
Try

=SUMPRODUCT(--(LEFT(A2:A1000,2)=LEFT(A2,2)),--(LEFT(B2:B1000,2)=LEFT(B2,2)),--(LEFT(C2:C1000,2)=LEFT(C2,2)))
 
Upvote 0

Forum statistics

Threads
1,216,485
Messages
6,130,938
Members
449,608
Latest member
jacobmudombe

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