ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Formula question (https://www.excelbanter.com/excel-discussion-misc-queries/224475-formula-question.html)

Fgbdrum

Formula question
 
Here's my spreadsheet:

Column A Column B
N Red
N Blue
N Red
Orange
N Blue
Red
N Yellow

Here's what I'd like to accomplish:
If there's an "N" in column A, then count the number of times "Red" and
"Blue" appear in column B. If there is no "N" in column A, do not count it.
In the above example, I'd expect the formula to return a result of four.

Thanks for the help.

Sheeloo[_4_]

Formula question
 
=SUMPRODUCT(--(A1:A100="N"),--(B1:B100="RED")) +
SUMPRODUCT(--(A1:A100="N"),--(B1:B100="BLUE"))

Change 100 to last row of your data...

"fgbdrum" wrote:

Here's my spreadsheet:

Column A Column B
N Red
N Blue
N Red
Orange
N Blue
Red
N Yellow

Here's what I'd like to accomplish:
If there's an "N" in column A, then count the number of times "Red" and
"Blue" appear in column B. If there is no "N" in column A, do not count it.
In the above example, I'd expect the formula to return a result of four.

Thanks for the help.


JLatham

Formula question
 

Try this formula somewhere on the sheet - It assumes that your entries begin
on row 2.
=SUMPRODUCT(--(A2:A8="N"),--(B2:B8="red")) +
SUMPRODUCT(--(A2:A8="N"),--(B2:B8="blue"))
but if the actually start on row 1:
=SUMPRODUCT(--(A1:A7="N"),--(B1:B7="red")) +
SUMPRODUCT(--(A1:A7="N"),--(B1:B7="blue"))


"fgbdrum" wrote:

Here's my spreadsheet:

Column A Column B
N Red
N Blue
N Red
Orange
N Blue
Red
N Yellow

Here's what I'd like to accomplish:
If there's an "N" in column A, then count the number of times "Red" and
"Blue" appear in column B. If there is no "N" in column A, do not count it.
In the above example, I'd expect the formula to return a result of four.

Thanks for the help.


Infinitogool

Formula question
 
fgbdrum escribió:
Here's my spreadsheet:

Column A Column B
N Red
N Blue
N Red
Orange
N Blue
Red
N Yellow

Here's what I'd like to accomplish:
If there's an "N" in column A, then count the number of times "Red" and
"Blue" appear in column B. If there is no "N" in column A, do not count it.
In the above example, I'd expect the formula to return a result of four.

Thanks for the help.


You could use
=SUMPRODUCT(--(A1:A100="N"),--(B1:B100={"RED","BLUE"}))

Best Regards,
Pedro J.


All times are GMT +1. The time now is 02:24 AM.

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