Count occurances Problem

  • Thread starter Thread starter Ed Gregory
  • Start date Start date
E

Ed Gregory

I have a range a1:a150 that can contain"rx" and could possibly contain
"rx(2)" which means there are 2 "rx" at location. Note: The same field can
have "rx,dx,sx" or "rx(2),dx,sx(4)", etc.

I want to count the occurrences when a1:a150 contains "rx" and add to count
by whatever is included in parentheses.

For example if a1-a5 contains "rx(2),sx" and a6-a10 contains "rx,dx" the
value of formula should return 15 because. I need to allow for multple
values per cell so I can do similar calcs based on different values
separated by commas.

Thanks in advance.
 
=sum(if(iserror(find("rx(",a1:A150)),if(iserror(find("rx",A1:A150)),0,1),value(mid(A1:A150,find("rx(",A1:A150)+3,1))))

enter as an array function (Control-Shift-Enter)
 
Thank you very much!!!


bj said:
=sum(if(iserror(find("rx(",a1:A150)),if(iserror(find("rx",A1:A150)),0,1),value(mid(A1:A150,find("rx(",A1:A150)+3,1))))

enter as an array function (Control-Shift-Enter)
 
Can be shortened to...

=SUM(IF(ISNUMBER(SEARCH("rx(",A1:A10)),MID(A1:A10,SEARCH("rx(",A1:A10)+3,
1)+0))

....confirmed with CONTROL+SHIFT+ENTER.

Hope this helps!
 

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