Help!php Posted February 23, 2012 Share Posted February 23, 2012 =IF(F29>=400,"A",IF(F29>=200,"B",IF(F29>=100,"C","Fail"))) Why wont this work. Any number I enter it displays A. Quote Link to comment https://forums.phpfreaks.com/topic/257623-simple-if-statement-wont-work-ms-excel/ Share on other sites More sharing options...
trq Posted February 23, 2012 Share Posted February 23, 2012 it wont work because it not valid php. Quote Link to comment https://forums.phpfreaks.com/topic/257623-simple-if-statement-wont-work-ms-excel/#findComment-1320410 Share on other sites More sharing options...
KevinM1 Posted February 23, 2012 Share Posted February 23, 2012 It won't work because that's not valid PHP. You need to do: if ($F29 >= 400) { echo "A"; } elseif ($F29 >= 200) { echo "B"; } elseif ($F29 >= 100) { echo "C"; } else { echo "Fail"; } For more info on conditionals in PHP, look at: http://php.net/manual/en/control-structures.if.php Quote Link to comment https://forums.phpfreaks.com/topic/257623-simple-if-statement-wont-work-ms-excel/#findComment-1320413 Share on other sites More sharing options...
Help!php Posted February 23, 2012 Author Share Posted February 23, 2012 I am trying this on Excel before I move on to PHP and it still wont work. I just want to get this running on excel. and It wont display the result Quote Link to comment https://forums.phpfreaks.com/topic/257623-simple-if-statement-wont-work-ms-excel/#findComment-1320414 Share on other sites More sharing options...
KevinM1 Posted February 23, 2012 Share Posted February 23, 2012 Why are you asking for help in Excel in the PHP Coding Help section of the forum? Moved. Quote Link to comment https://forums.phpfreaks.com/topic/257623-simple-if-statement-wont-work-ms-excel/#findComment-1320419 Share on other sites More sharing options...
Psycho Posted February 23, 2012 Share Posted February 23, 2012 That works fine for me in Excel. Are you sure the value you are referencing is really in cell F29 and that is a number type? Quote Link to comment https://forums.phpfreaks.com/topic/257623-simple-if-statement-wont-work-ms-excel/#findComment-1320471 Share on other sites More sharing options...
Help!php Posted February 24, 2012 Author Share Posted February 24, 2012 Yeh it is. I managed to get this done .. Thanks though Quote Link to comment https://forums.phpfreaks.com/topic/257623-simple-if-statement-wont-work-ms-excel/#findComment-1320796 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.