Help Please - CountIf and Array formula

  • Thread starter Thread starter Prickle
  • Start date Start date
P

Prickle

I'm struggling to get to grips with array formula and don't have much time
left and so I am asking for your help to programatically enter a fomula that
will count
the cells in Range(A2:A500) that contain String_A whose corresponding cell
in Range(N2:N500) contains String_B

My grateful thanks in advance for any help
 
i believe this will do want you need,

=SUMPRODUCT((A2:A500="string_a")*(n2:n500="string_2"))
 
range("a1").formula=
"=SUMPRODUCT((A2:A500="string_a")*(n2:n500="string_2"))"
 
If String_A and String_B are litterals that you are looking for

s = "=Sumproduct(--(A2:A500=""String_A""),--(N2:N500=""String_B""))
ActiveCell.Formula = s

if these are variables that contain string litterals

String_A = "a23rt"
String_B = "Johnson"
s = "=Sumproduct(--(A2:A500=""String_A""),--(N2:N500=""String_B""))
s = replace(s,"String_A",String_A)
s = replace(s,"String_B",String_B)
ActiveCell.Formula = s
 
Don probably meant:

range("a1").formula= _
"=SUMPRODUCT((A2:A500=""string_a"")*(n2:n500=""string_2""))"
 

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

Back
Top