Things are much clearer with samples. As you already have the Range Names, try
=IF(Logout>Login,Logout-Login,(Logout+24)-Login)