SUMIF, does not distiguish between similar numbers

Dannyh1

Well-known Member
Joined
Nov 18, 2009
Messages
1,144
Hi,

I have a situation where my SUMIF does not distinguish between 2 codes. Instead of summing them seperately, in adds them together.

The numbers are similar 6 digit numbers, but the last digit is different:

501393 = £4780.97
501392 = £51,989.76

My SUMIF result for both references = £56,770.73

This also happens for below codes

521160
521165

Has anyone come across this before/ have a solution?

Many Thanks.
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
Peter apologies,

I have mis-posted. the Sumif is actually working off a combination of 2 codes (cost centre & gl)

the codes that do not seem to seperate are:

2709565100501392
2709565100501393

Many Thanks.
 
Upvote 0
Hi,

I have a situation where my SUMIF does not distinguish between 2 codes. Instead of summing them seperately, in adds them together.

The numbers are similar 6 digit numbers, but the last digit is different:

501393 = £4780.97
501392 = £51,989.76

My SUMIF result for both references = £56,770.73

This also happens for below codes

521160
521165

Has anyone come across this before/ have a solution?

Many Thanks.
Try using the equivalent SUMPRODUCT formula and see if that makes a difference.

=SUMPRODUCT(--(A1:A10=code),B1:B10)
 
Upvote 0
Peter apologies,

I have mis-posted. the Sumif is actually working off a combination of 2 codes (cost centre & gl)

the codes that do not seem to seperate are:

2709565100501392
2709565100501393

Many Thanks.
Ok, that's the problem.

The SUMIF function is only evaluating the first 15 characters of the 16 character string. This is a quirk in Excel where a couple of functions (COUNTIF(S) and SUMIF(S)) evalaute numeric numbers and text numbers as being equal. Excel only works on numbers to 15 significant digits so those 16 character strings are TEXT even though they look like numbers.

Then, Excel is getting confused and only evaluating the first 15 characters as numeric values so that's how you end up where you are.

The solution is to use the SUMPRODUCT function. It does not evaluate text numbers and numeric numbers as being equal.
 
Upvote 0

Forum statistics

Threads
1,224,574
Messages
6,179,626
Members
452,933
Latest member
patv

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