help wit formula

C

cyndi

Hello,
I have a row with the weekdays in each column, the cell for each day could
be an x, t, t/x, or L, I want to count how many days in one week have an "x",
"T", or an "T/X", but i do not want to count the days that are blank or have
an "L", I tried a nested if or functions, but it doesn't seem to work with a
range, or one cell at a time,

Example, the answer to this would be 3

Mon Tue Wed Thu Fri
T X L T/x

I am using excel 2003, any help would be awesome!

Thank you in advance
 
J

JLatham

How about this, assuming entries are on row 2, columns A:E

=COUNTA(A2:E2)-COUNTIF(A2:E2,"L")

The COUNTA portion counts all non-blank entries, the COUNTIF counts those
with L only. So result is 3 for your test data.
 
C

cyndi

Toppers and Jlatham, they both worked perferct, you guys are the best, I
understand what Jlatham is doing but Toppers I am not sure what everything
means, the (-- and the * between the 2 ranges, don't get me wrong I don't
care as long as it works (which they both did) just courious how

Thanks again
 
J

John Bundy

This will give a summary count of each type within that row
="T=" & COUNTIF(A2:E2,"t") & ", " & "X=" & COUNTIF(A2:E2,"x") & ", " &
"T/X=" & COUNTIF(A2:E2,"t/x")
 
T

Toppers

The -- converts a TRUE/FALSE to 1/0 so SUMPRODUCT can then do the arithmetic.

In my posting it is redundant as the * (multiply) does the same thing, so
the options are:

=SUMPRODUCT(--(A2:E2<>""),--(A2:E2<>"L"))

or

=SUMPRODUCT((A2:E2<>"")*(A2:E2<>"L"))

The first (I believe) is slightly more efficient than the latter.

HTH
 
J

JLatham

You're correct about the , version being quicker than the * version. I just
'stumbled' over that little tidbit of information recently myself. Doesn't
matter too much when just a couple of the formulas are involved, but
obviously multiplies the slowdown when there are large numbers of them, and
SUMPRODUCT() is a rather slow function anyhow - too bad it isn't quicker
since it's so darned handy for so many things.
 

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