Sum if match any six numbers

X

XP

Hi,

I need an array function such that:

Sum(If( G2:G5836 = <any six numeric digits>, I2:I5836,0))

Obviously, I need the part on how to match any six numeric digits (e.g.
123456) in the above formula, can someone please help me out on this?

Thanks much in advance.
 
S

Sandy Mann

Try:

=SUM(IF(ISNUMBER(G2:G5836)*LEN(G2:G5836)=6, I2:I5836,0))

Array entered with Ctrl + Shift + Enter or:

=SUMPRODUCT((ISNUMBER(G2:G5836)*(LEN(G2:G5836)=6)*I2:I5836))

Normally entered


--
HTH

Sandy
In Perth, the ancient capital of Scotland
and the crowning place of kings

(e-mail address removed)
Replace @mailinator.com with @tiscali.co.uk
 
H

Harlan Grove

Sandy Mann said:
Try: ....
=SUMPRODUCT((ISNUMBER(G2:G5836)*(LEN(G2:G5836)=6)*I2:I5836))
....

Would include -87654, 12.345, etc. Try instead

=SUMPRODUCT((G2:G5836>=100000)*(G2:G5836<=999999)
*(G2:G5836=INT(G2:G5836)),I2:I5836)

Rule of thumb: NEVER use text operations on numeric data if there's an
equivalent arithmetic operation.
 
S

Sandy Mann

Would include -87654, 12.345, etc
Very true. That's why I frequent these NG's - to try to keep the Alzheimer's
at bay.

Thank you for pointing it out.

--

Sandy
In Perth, the ancient capital of Scotland
and the crowning place of kings

(e-mail address removed)
Replace @mailinator.com with @tiscali.co.uk
 
D

Dave

Hi,
Perhaps this:
=IF(SUMPRODUCT(--(LEN(G2:G5836)=6)*(ISNUMBER(G2:G5836)))=1,I2:I5836,0)
Array entered.
Regards - Dave.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top