
#1
Nov3007, 04:53 PM

P: 21

Does anyone know how to do this with ifthen statements or something else?
For example: I want to analyze inflow and outflow in a tank, when the volume reaches zero then it's empty of courseso I shouldn't have a negative volume after this, volume should just be zero until I can finally get a large enough inflow. Say I'm doing this in minutes. 



#2
Nov3007, 05:54 PM

Mentor
P: 39,723

Sounds like the floor function in Excel would do what you want. Try help floor.




#3
Nov3007, 05:59 PM

Mentor
P: 39,723





#4
Nov3007, 06:01 PM

Mentor
P: 39,723

MS Excel Help  Saturation Points ?!So use =IF(cell_reference < 0, 0, cell_reference) Here are two columns of numbers: The first is just the numbers, and the second column uses the above equation in each cell, with the cell_reference equal to the cell to its left. Just use controld to pull the first cell equation down to all the cells in the right column to get the calculations done.




#5
Nov3007, 07:58 PM

Sci Advisor
P: 5,095

I'm not sure what your volume calcs look like, but a standard IF() function in Excel would look like:
IF(A1>0,ENTER CALC HERE,0) where A1 is the cell that would display the tank volume. 



#6
Dec407, 09:06 AM

Sci Advisor
P: 2,283

You have to use VBA in Excel to use the full IFTHENELSE statement.
IF dummy > 10 THEN msgbox "dummy is greater than 10" ELSE msgbox "dummy is less than or equal to 10" END IF I'm not sure what you are asking about the rest of the question. 



#7
Dec407, 05:27 PM

Mentor
P: 22,010

No, the excel command contains the "else". It's the 3rd term in Fred's statement.
Also, my read of the question says that both the first and second terms should be the equation  first as an argument, then as an output. Ie: =if([your function]>0,[your function],0) But it is tough to know for sure without getting more specifics of the problem. 



#8
Dec407, 07:01 PM

Sci Advisor
P: 2,283

My comment was that if you want to use the full functionality to use VBA. That way you can use nested statements (a lot easier anyway), plus loops, etc... It just depends on how complicated your calculation is (or what ever you need the app to do). If you need just one simple IfThenElse statement, then of course the Excel function IF() would work just fine. 



#9
Dec507, 06:07 PM

P: 21

I guess berkeman's solution makes sense, I have to look at my excel model *later* and see if that would work. Thanks.




#10
Dec507, 06:21 PM

P: 21

Here's a stripped down version of the stuff I was working on.
It's a model of the volume in a tank, ignoring how a real tank's outflow would change with the amount of mass in the tank. 



#11
Dec1607, 10:30 PM

Sci Advisor
HW Helper
P: 3,680

In this particular case the IF statement is overkill. You could just use
=MAX(0, [formula here]) 


Register to reply 
Related Discussions  
CO2 saturation point?  Earth  17  
Saturation Vapour Pressure  Classical Physics  5  
Magnetic Saturation??  General Physics  1  
Nuclear force saturation  Introductory Physics Homework  2  
Saturation current.  Atomic, Solid State, Comp. Physics  1 