ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   if then statements (https://www.excelbanter.com/excel-discussion-misc-queries/167277-if-then-statements.html)

Doug

if then statements
 
I am doing a math project due tomorrow and I have data from rolling two dice
fifty times. I have a left die and right die column. Trying to use
"if-then" statements to count different outcomes (i.e., product is over 20,
sum is 5, left die is odd, both dice are equal, etc) Any ideas how I can make
this work?

joeu2004

if then statements
 
On Nov 25, 11:20 am, doug wrote:
I am doing a math project due tomorrow and I have data from rolling
two dice fifty times. I have a left die and right die column. Trying to use
"if-then" statements to count different outcomes (i.e., product is over 20,
sum is 5, left die is odd, both dice are equal, etc) Any ideas how I can
make this work?


Are you referring to the VBA IF statement or the Excel IF() function?

Assuming the latter, if your assignment requires that you use IF() for
the solution, array formulas are one way to do it. After typing the
formula, commit by pressing ctrl+shift+Enter instead of just Enter.
If you forget, select the cell, press F2, then press ctrl+shift
+Enter. For example:

=sum(if(L1:L50*R1:R5020, 1, 0))

Remember to press ctrl+shift+Enter.

Alternatively, you can avoid array formulas with the following:

=sumproduct(--(L1:L50*R1:R5020))

Remember to press just Enter.


All times are GMT +1. The time now is 12:20 AM.

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