"Sumif" leads to wrong results

HongRu

Board Regular
Joined
Nov 24, 2022
Messages
191
Office Version
  1. 2021
Platform
  1. Windows
Hi guys!

"Sumif" leads to wrong result at the range("E2").

Why does it lead to the wrong result?

How to fix or avoid the wrong result?

I would appreciate this.
HongRu

sumif.xlsx
ABCDE
1ItemPriceItemPrice
21-1311-13321
313-120
413-1300
sheet1
Cell Formulas
RangeFormula
E2E2=SUMIF(A1:A4,D2,B1:B4)
 
I used to think of SumIf / CountIf etc as being more being more forgiving in terms of mixed data types but in your case it's working against you.
I can replicate your issue by changing my Windows Short Date to yyyy-mm-dd and I can't find a way around it using SumIf or SumIfs.
It looks like Sum/SumProduct (or Sum + Filter) as you have already identified are your best options.

1722147953133.png
 
Upvote 1
Solution

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
I used to think of SumIf / CountIf etc as being more being more forgiving in terms of mixed data types but in your case it's working against you.
I can replicate your issue by changing my Windows Short Date to yyyy-mm-dd and I can't find a way around it using SumIf or SumIfs.
It looks like Sum/SumProduct (or Sum + Filter) as you have already identified are your best options.

View attachment 114620
Thanks for your reply.
 
Upvote 0
Thanks for raising the issue. It has provided a bit more insight into how the SumIf group of functions convert both the range and criteria to numbers where they can under the hood.
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,239
Members
452,621
Latest member
Laura_PinksBTHFT

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