Filtering with "SUMPRODUCT()" raises "a value used in the formula is of the wrong data type"

MC_Kay

New Member
Joined
Feb 11, 2022
Messages
6
Office Version
  1. 365
  2. 2013
Platform
  1. Windows
  2. Web
Hello together,
I'm stuck at a "SUMPRODUCT()" formula.
I want to use that formula as filter (VLOOKUP()) for several criteria. But stuck at a point I don't understand.

My sheet has a table with > 3 columns.
Columncontainstypeempty rows
Atimestampstringno
Bitem-idintegerno
Cstatestringsome

I want to get the state over the time.

The formula I've used:
Code:
=SUMPRODUCT((A3:A100=A1)*(B3:B100=B1)*C3:C100)
but I got #VALUE! with the yellow square: "a value used in the formula is of the wrong data type"

What I tried:
Missing "()"
Code:
=SUMPRODUCT((A3:A100=A1)*(B3:B100=B1)*(C3:C100))
Still the same issue.

Code:
=SUMPRODUCT((A3:A100=A1)*(B3:B100=B1))
This returns 1

I was thinking: Maybe the values I gave in row 1 aren't good, so I tried to search by values inside of the database as reference:
Code:
=SUMPRODUCT((A3:A100=A4)*(B3:B100=B4)*C3:C100)
But with the same issue.

Than I've tried to search not in column C, but in B instead:
Code:
=SUMPRODUCT((A3:A100=A1)*(B3:B100=B1)*B3:B100)
and I got as result the vale I expected (Given in B1). But I want to get the value of column C and not B!

What I'm doing wrong here?

I hope you can help me ;)
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
If column C is a String, what do you hope to return by multiplying it?

You could simply use FILTER in 365, or something like:

Excel Formula:
=LOOKUP(2,1/(A3:A100=A1)/(B3:B100=B1),C3:C100)

in other versions.
 
Upvote 0
If column C is a String, what do you hope to return by multiplying it?
Oh. xD

I was thinking, that it'll work with everything and not numbers only.
But thank you. the formula you've posted works very well (y)
 
Upvote 0
Sry for double post, but I didn't fount the "edit" button.

The first try was to get a number:
Column D to F containing number only and got the same issue:
Code:
=SUMPRODUCT((A3:A100=A1)*(B3:B100=B1)*D3:D100)
"a value used in the formula is of the wrong data type"

Why?
 
Upvote 0
Does the data start in row 3 or is that a header row?
 
Upvote 0
Does the data start in row 3 or is that a header row?
Rows:
1: criteria I want to filter for
2: header
3: first row that contains data
...
100. last row that contains data

That means, I've selected the ranges that contains data only (no headers).
 
Upvote 0
It would seem that there is something in column D that the formula doesn't like. Try:

Excel Formula:
=SUMPRODUCT((A3:A100=A1)*(B3:B100=B1),D3:D100)

and see if that works.
 
Upvote 0
It would seem that there is something in column D that the formula doesn't like.

Maybe, but all the values in column D are numbers. Ok, some are empty, but that shouldn't raise that error.

Excel Formula:
=SUMPRODUCT((A3:A100=A1)*(B3:B100=B1),D3:D100)

Yes, that worked. (y)
When I use that on column C (with strings) I got 0 and not "#VALUE!" anymore :confused:

Thank you ;)
 
Upvote 0
You can't use SUMPRODUCT with strings since its entire purpose in life is to multiply numbers, then add them up. ;)
 
Upvote 0

Forum statistics

Threads
1,215,128
Messages
6,123,204
Members
449,090
Latest member
bes000

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