How to count cells that do not contain "-"

  • Thread starter Thread starter jcannon1
  • Start date Start date
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.
 
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.)
 
ps. I'm assuming that you really have a dash in the cell. Not a 0 with a
special format.
 
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
 
Thanks... It worked perfectly! I was having a brain fart because this is a
pretty easy formula.
 
Thanks Mike! This worked perfectly. Can you tell me what the 2 dashes ("--")
after the sumproduct signify?
 
Back
Top