简体   繁体   中英

Ignore non-numeric values in sumproduct formula in excel

I tried to use sumproduct formula, but it doesn't ignore non numeric (text) values.

Tried double unary. But nothing works

=SUMPRODUCT((A2:A8="TX")*B2:B8)
=SUMPRODUCT(--(A2:A8="TX")*B2:B8)
=SUMPRODUCT((A2:A8="TX")*--B2:B8)
=SUMPRODUCT(--(A2:A8="TX")*--B2:B8)

State   Sales
UT  75
CO  100
TX  125
CO  125
TX  150
TX  a
CO  50

I know sumif can do, but im trying to achieve the same from Sumproduct, coz i need to apply it in larger frame

try

=SUMPRODUCT(--(A2:A8="TX"),B2:B8)

在此处输入图像描述

SUMPRODUCT function treats non-number value as zero. So, you can directly use B2:B8 as second argument without considering if it a text or number.

Try this one

=SUMPRODUCT((A2:A8="TX")*(ISNUMBER(B2:B8)))

To get the logical values. If you want the result:

=SUMPRODUCT((A2:A8="TX")*(ISNUMBER(B2:B8)),B2:B8)

Use ISNUMBER function which will ignore the non numeric value.

=SUMPRODUCT((A2:A8="TX")*(ISNUMBER(B2:B8)),B2:B8)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM