Sumproduct or countifs when using left function over an array

jblonde002

Board Regular
Joined
Jun 10, 2014
Messages
61
Pardon my ignorance but I'm struggling with this one! I have an dataset as shown below:
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD][/TD]
[TD]A[/TD]
[TD]B[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]77+[/TD]
[TD]77[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]98-[/TD]
[TD]88[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]66=[/TD]
[TD]66[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]55+[/TD]
[TD]66[/TD]
[/TR]
</tbody>[/TABLE]

The formula I would like to crack requires comparing the leftmost digit from column A to the leftmost digit in column B over the array and summing the total that are under/on/over. So using this example:

Over target (where A>B): 1 A2
On target (where A=B): 2 A1,A3
Below target (where A<B) 1A<b: <strong="">1 A4

I've tried =countif(value(left(A1:A4,1)=value(left(B1:B4,1) but I'm definitely not on the right lines as Excel won't even let me enter it! Thanks for any help you can give!</b:>
 
Last edited:

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
Thanks for replying. My example might be a bit unclear because when something is over/under it could be by any amount, but I would want it to count as "one example of being under" in this array.

For example comparing 66 to 99 I would not want it to return 3 or 33, but to return 1, because this is one comparison that is under.
 
Last edited:
Upvote 0
I thought you wanted to add column B for the cases that match.

If you just want to count them, try for on target:

=SUMPRODUCT(--(LEFT(A1:A4)=LEFT(B1:B4)))
 
Upvote 0

Forum statistics

Threads
1,223,227
Messages
6,170,848
Members
452,361
Latest member
d3ad3y3

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