ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   help wit formula (https://www.excelbanter.com/excel-discussion-misc-queries/151274-help-wit-formula.html)

cyndi

help wit formula
 
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

Toppers

help wit formula
 
Try:

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

HTH

"cyndi" wrote:

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


JLatham

help wit formula
 
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.

"cyndi" wrote:

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


cyndi

help wit formula
 
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

"JLatham" wrote:

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.

"cyndi" wrote:

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


John Bundy

help wit formula
 
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")
--
-John
Please rate when your question is answered to help us and others know what
is helpful.


"cyndi" wrote:

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


Toppers

help wit formula
 
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 a

=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


"cyndi" wrote:

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

"JLatham" wrote:

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.

"cyndi" wrote:

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


cyndi

help wit formula
 
Thanks everyone, this was awesome and informative at the same time!

"John Bundy" wrote:

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")
--
-John
Please rate when your question is answered to help us and others know what
is helpful.


"cyndi" wrote:

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


JLatham

help wit formula
 
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.

"Toppers" wrote:

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 a

=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


"cyndi" wrote:

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

"JLatham" wrote:

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.

"cyndi" wrote:

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



All times are GMT +1. The time now is 07:19 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com