SUMPRODUCT returning 0

tjiddy89

New Member
Joined
Mar 7, 2018
Messages
20
Hello all! Just started learning more formulas and VBA scripting for my job, but I'm running into an issue with the SUMPRODUCT formula returning 0 instead of the actual number. My intent was to have this run through the specified closed workbook and range and then return the number of cells with a value of 2.

Code:
=SUMPRODUCT('C:\Desktop\[test.xlsx]Sheet1'!$D$2:$D$85="2")

Also, I've verified the sourced data in John test.xlsx only contain numerical characters but are formatted as "General". Could this by chance be the culprit? Thanks a ton in advance for your help!
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
Hello all! Just started learning more formulas and VBA scripting for my job, but I'm running into an issue with the SUMPRODUCT formula returning 0 instead of the actual number. My intent was to have this run through the specified closed workbook and range and then return the number of cells with a value of 2.

Code:
=SUMPRODUCT('C:\Desktop\[test.xlsx]Sheet1'!$D$2:$D$85="2")

Also, I've verified the sourced data in John test.xlsx only contain numerical characters but are formatted as "General". Could this by chance be the culprit? Thanks a ton in advance for your help!

Welcome to the board.

Most likely, yes. Your formula is only going to match values of 2 stored as text because of the " ". Remove them from around the 2, and you should see a different result.
 
Upvote 0
Welcome to the board.

Most likely, yes. Your formula is only going to match values of 2 stored as text because of the " ". Remove them from around the 2, and you should see a different result.

Still no dice unfortunately. I've even attempted to change the referenced source data to Number but it still returns 0.
 
Upvote 0
=SUMPRODUCT(--('C:\Desktop\[test.xlsx]Sheet1'!$D$2:$D$85=2))

Edit: Assuming you're looking for the number 2, not "2"
 
Last edited:
Upvote 0
And by verified, have you tried =ISNUMBER(A1) and or =A1=2? A1 being whichever cell contains a 2 you are trying to match.
 
Upvote 0
=SUMPRODUCT(--('C:\Desktop\[test.xlsx]Sheet1'!$D$2:$D$85=2))

Edit: Assuming you're looking for the number 2, not "2"

That worked perfectly! Thank you! What exactly are the extra characters for? The "--(" and extra parenthesis on the end?
 
Upvote 0
The expression returns TRUE or FALSE; the double negation converts those to 1 and 0.
 
Upvote 0

Forum statistics

Threads
1,223,888
Messages
6,175,207
Members
452,618
Latest member
Tam84

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