How to count cells that do not contain "-"

J

jcannon1

I have a row of data where each cell is using a VLOOKUP formula - the formula
either returns a number or "-". I need to count all the cells that contain a
NUMBER only and I don't want to count the cells that contain "-". I have
tried COUNTIF, SUMPRODUCT...

Please help

Example

A B C D
1 3 - 4 I want formula in this cell to return the
value of 2 (because there are numbers in cell A1 and C1, while B1 contains
"-" which I don't want to count.
 
D

Dave Peterson

If the choices for each cell are a number of a dash, then you can use:
=count(a1:c1)
to count the numbers

If you could have anything in those cells, you could use:
=3-countif(a1:c1,"-")
(3 is the number of cells in the range you're checking.)
 
D

Dave Peterson

ps. I'm assuming that you really have a dash in the cell. Not a 0 with a
special format.
 
A

Alan Beban

jcannon1 said:
I have a row of data where each cell is using a VLOOKUP formula - the formula
either returns a number or "-". I need to count all the cells that contain a
NUMBER only and I don't want to count the cells that contain "-". I have
tried COUNTIF, SUMPRODUCT...

Please help

Example

A B C D
1 3 - 4 I want formula in this cell to return the
value of 2 (because there are numbers in cell A1 and C1, while B1 contains
"-" which I don't want to count.
=COUNTIF(A1:C1,"<>-")

Alan Beban
 
J

jcannon1

Thanks... It worked perfectly! I was having a brain fart because this is a
pretty easy formula.
 
J

jcannon1

Thanks Mike! This worked perfectly. Can you tell me what the 2 dashes ("--")
after the sumproduct signify?
 

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