ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   can someone please tell me what i did wrong with this if statement? (https://www.excelbanter.com/excel-programming/400962-can-someone-please-tell-me-what-i-did-wrong-if-statement.html)

unclescrooge

can someone please tell me what i did wrong with this if statement?
 
hi,

this is for keeping baseball stats. i basically want to insert into
the spreadsheet to calculate ERA if the player's position (C3) = P
(for pitcher) otherwise insert a zero.

=IF(C3=P,O3*9/P3,0)

O3 = number of earned runs
P3 = number of innings pitched

i did something similar to calculate batting average,

=IF(D2=0,0,E2/D2)

where D2= at bats
E2= hits

and that one seems to work just fine.


carlo

can someone please tell me what i did wrong with this if statement?
 
On Nov 12, 2:11 pm, unclescrooge wrote:
hi,

this is for keeping baseball stats. i basically want to insert into
the spreadsheet to calculate ERA if the player's position (C3) = P
(for pitcher) otherwise insert a zero.

=IF(C3=P,O3*9/P3,0)

O3 = number of earned runs
P3 = number of innings pitched

i did something similar to calculate batting average,

=IF(D2=0,0,E2/D2)

where D2= at bats
E2= hits

and that one seems to work just fine.


You have to tell excel, that "P" is a string:

=IF(C3="P",o3*9/P3,0)

hth

Carlo


unclescrooge

can someone please tell me what i did wrong with this if statement?
 
On Nov 11, 11:25 pm, carlo wrote:
On Nov 12, 2:11 pm, unclescrooge wrote:





hi,


this is for keeping baseball stats. i basically want to insert into
the spreadsheet to calculate ERA if the player's position (C3) = P
(for pitcher) otherwise insert a zero.


=IF(C3=P,O3*9/P3,0)


O3 = number of earned runs
P3 = number of innings pitched


i did something similar to calculate batting average,


=IF(D2=0,0,E2/D2)


where D2= at bats
E2= hits


and that one seems to work just fine.


You have to tell excel, that "P" is a string:

=IF(C3="P",o3*9/P3,0)

hth

Carlo- Hide quoted text -

- Show quoted text -


ah that explains it. i didn't think of that. thank you



All times are GMT +1. The time now is 11:41 AM.

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