SUMPRODUCT + MID multiple sheets - not working?

Camel123

Board Regular
Joined
Jun 5, 2018
Messages
186
Hi,

Trying to sum multiple columns from another sheet based on one criteria, which is determined by the "MID" function. What is wrong with the formula?

1) B2 (formatted as text)=9132456, 6753456

2) 6753456 appears in D:D (formatted as text as well). It has 100$ in col. P and -10$ in Q. Should return 90$ then but I get #value !


{=SUMPRODUCT(--('export'!D:D=MID('upload'!B2;10;7)*('export'!P:Q)))}

Tried without {} and -- but makes no difference.
 
If you are getting a value error I'd suggest either there is a value error in the data or there is text within the part you want to add.
 
Upvote 0

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
Let me re-do everything and get back to you guys, if I don't manage to solve it I will post some screenshots on the evaluation.
 
Upvote 0
I evaluated the formula. The issue is caused by the sum range containing cells in text, such as "grand total" etc. Any workaround on this?
 
Last edited:
Upvote 0
Try SUMIF instead:

=SUMIF(export!D:D;MID(upload!B2;10;7);export!P:P)+SUMIF(export!D:D;MID(upload!B2;10;7);export!Q:Q)

EDIT: Changed list separator to a ; from , (to fit your settings)
 
Last edited:
Upvote 0
It works, BUT since some values in column B only contain one number with 7 digits and not two, the MID returns BLANK and sums all values for all BLANKS in the criteria range, which should be ignored. :D
 
Upvote 0
Are you dragging this formula down the column then? As I assumed it would only look at B2 specifically for middle characters
 
Last edited:
Upvote 0
I am dragging it down. I took the "MID" value *1 and it solved the issue, ignores the blanks now and returns correct values. Though I am surprised because using *1 should make the criteria a number, and the criteria range is numbers stored as text, but it still works so...
 
Upvote 0
Excellent! Glad its sorted now then, got so used to using SUMPRODUCT now that I completely overlooked SUMIF until the last hour... Madness!
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,337
Members
452,637
Latest member
Ezio2866

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