Search:

CountIF Function

Asked By: Nisha    Date: Jan 06    Category: MS Office    Views: 543

I know this isn't strictly a VBA question but it is used in my spreadsheet that
you've helped on before.

I have a countif function counting for particular letters and times by the cell
value above it but occasionally the cells lose the references.

I want to count multiple letters and this is the way I have found works but is
there a better way?

Note the + inbetween each countif statement.

=COUNTIF(B7,"H")*B6+COUNTIF(B7,"B")*B6+COUNTIF(B7,"HD")*B6

Share:

Why are you using a COUNTIF to search just the single cell B7? This would
better be done with a simple IF statement. I.e. your statement  can be
replaced with

=IF(OR(B7="H",B7="B",B7="HD"),B6,0)

But what do you mean by "... occasionally the cells  lose the references"?

You are a star as always.

That work perfectly. I think because I've adapted my spreadsheet  to work in
another way I didn't consider changing the way it counted the cells.

And by losing the references  i meant that the countif's would lose the reference
to which cell they were looking at and i an only presume it was my rubbish
statement that was doing it.

Once again thank you for your time.

See if this one gives you what you need:
=ISNUMBER(MATCH(B7,{"H";"HD";"B"},0))*B6

Didn't find what you were looking for? Find more on CountIF Function Or get search suggestion and latest updates.