Is it really better for the environment if I take the stairs as opposed to a lift? This question is inspired by a sign I saw at a lift, which said something like: 

Going up 1 floor or down 2 floors? Take the stairs, it's better for your health and for the environment.

There's no doubt that taking the stairs is better for one's health, but the physicist in me wonders about the latter. An analysis:


*

*Presumably whoever wrote that sign was thinking about energy usage. By taking the stairs instead of the lift, I save on the electricity required to power the lift.

*However, gravity is a conservative field. The end result in both cases is that I move up one floor, so the amount of work (i.e. energy) required to get me up one floor is independent of the path I take. It should only depend on the initial and final states. Therefore, the electricity saved is compensated for by the fact that I need to eat more food (so my muscles can produce the energy required to move me up one floor).

*If I take the stairs, I do more than $mgh$ of work, because the stairs isn't completely vertical and there's some amount of horizontal work done. Therefore it's actually more energy-intensive overall to take the stairs instead of the lift. (There is also some kinetic energy I have to impart to my body to make it move upwards, but my body also has kinetic energy in the lift, and we assume they are equal.)

*However #3 seems superficial because the final state isn't exactly the same: the lift has also moved up one floor. The mass of the lift is obviously quite large, so to get it up one floor takes more energy.

*But it's exactly because of this that modern lifts use a counterweight that serves as a gravity battery. Whenever the electric motor moves the lift down, some amount of weight is lifted as a counterbalance. When the lift moves up, most of the energy comes from the potential energy stored in the gravity battery; the electric motor doesn't actually do much work. Besides, even if the electric motor does more work, the argument only holds in one direction. If it takes more energy to go up the building (compared to walking), it takes less energy to go down the building (compared to walking).

*If we assume that on average I move both up and down the building, then this difference cancels out, and we're left with the argument in #3. 


Conclusion: the sign is wrong. It's (slightly) worse for the environment to take the stairs instead of the lift.
I'm wondering if this analysis is good or if I missed something.
 A: I follow your analysis but not your conclusion. You are missing two key points, which as far as I can see might outweigh all the other points you mention:

*

*You must compare the efficiency of the electric engine running the lift with your body-"engine".


*You must compare the "fuel" that the electric engine and your body-"engine" use.
To the first case, all your other points pale and are negligible, if an old inefficient engine is in use, or opposite if you as the person walking up the stairs have a hard an inefficient time doing so.
To the second case, what if the electric engine is run by the roof solar panel, geothermal heating or a local wind turbine? Then the elevator's impact becomes negligible*. On the other hand, if you eat, drink and gain nutrition in an environmentally sustainable manner**, then your impact might be considered negligible.
These thermodynamic and fuel-production factors*** are, as far as I can see, more important than your presented analysis, which is based purely on mechanical energy.

* Unless we include an analysis of the lifetime, production and disposal of the solar cell, geothermal plant or wind turbine, in which case they will never win with current development technologies. We will then also have to consider other uses of these sources, and the math quickly becomes large and complicated.
** Home-grown vegetables etc.
*** I'm sure we can find more such factors if we dig deep into the details of the lift technology and human physiology. The environmental-impact-math will also highly depend on how we estimate and evaluate indirect factors that may make all of your and my points moot, some of which are mentioned in comments and other answers, such as the energy storing capability of a lift's counterweight or such as the question of whether the lift will be implemented and in use regardless of what you choose to do due to regulation requirements and accessibility for the disabled/elderly.
A: I don't think this question can be answered because you need to know a lot of information about efficiency and how electricity is generated and so on (including the efficiency of the generation).
But the big environmental issue with using energy isn't how much heat is generated, it's how much $\mathrm{CO}_2$ is generated.  Unfortunately this doesn't really help: the answer can still go both ways I think.
The way that makes the sign perhaps right:


*

*you're a vegetarian (better, a vegan), so you are eating plants which have recently captured $\mathrm{CO}_2$ from the atmosphere to make, well, plant, and releasing some of it back into the atmosphere by respiration – this process might even be pulling more $\mathrm{CO}_2$ from the atmosphere than it is releasing into it, I'm not sure;

*the electricity that powers the lift is generated by fossil fuel, and is therefore turning long-term-stored carbon into $\mathrm{CO}_2$.


The way that makes the sign perhaps wrong:


*

*the lift runs from solar power on the roof with perhaps a battery so it works at night;

*you live entirely off prime beef.

A: 
modern lifts use a counterweight that serves as a gravity battery

I believe you've misunderstood that reference. The counterweight isn't there to store energy. It's there to offset the weight of the lift, as well as half the expected load.
This allows the motor operating the lift to, on average, only have to overcome internal friction. Of course, some of the time it has to work a little harder to raise the lift, while other times it has to work a little harder to lower the lift. But in neither case is the counterweight capturing any energy.
If you want to treat the counterweight as a "gravity battery", then logically the lift cab itself must also be a gravity battery. After all, each technically "stores" energy as it's raised, and "releases" the energy as it falls. Note also that taking this stance leads logically to the conclusion that a wheel with its axis oriented horizontally would also necessarily be a gravity battery under this definition. After all, if the wheel is turning, then one side is always losing energy as it descends in the gravity field (giving up "stored" energy), while the other side is gaining energy as it ascends in the same field ("storing" energy).
Personally, I find this way of looking at it unproductive and would not call the counterweight a "gravity battery". In none of those examples is the so-called "battery" storing energy in any constructive manner, because it can only do so by taking that energy from the other "battery" in the system. But judging from some comments, there are at least a couple of people who would disagree. YMMV.
Speaking of internal friction, your analysis seems to leave that out. There is very little friction involved in walking up the stairs, but there's a reasonable amount of friction involved in the systems for a lift, especially a cable-driven one. This friction is just one small part of the overall question of efficiency, which is touched on in other answers.
Suffice to say, those answers are correct to point out that environmentally what will matter is how efficiently energy extracted from the environment is put to work to lift you from one floor to the other. It would not take too much work to show, based on existing research and energy costs, that after efficiency is considered, the typical lift uses way more energy than someone walking does. Biological conversion of energy inputs into energy are generally more efficient at each step — even if one accepts the argument that non-vegetarian diets are less efficient, and we assume a non-vegetarian person — and so of course the overall efficiency is also greater.
All of this doesn't even take into account the additional wear and tear the lift incurs when you use it, which itself will eventually lead to increased impacts on the environment, due to the need to manufacture and replace parts, or even the entire lift itself.
Ironically, the human body is for the most part a "use it or lose it" proposition. While technically walking incurs more wear and tear than standing, it's "built" for that, and the walking actually will help improve the overall reliability and reduce the chances that repair or replacement would be needed (knee surgery, for example). (This is for the average person; for a person with some existing medical issue, the analysis could well be different.)
Finally, one thing not addressed so far is that improving one's own health is itself inherently better for the environment. A person in poor health is going to use energy less efficiently, causing a direct and immediate impact on the environment, and they will also consume greater energy costs as they age, leading to additional impacts. (This assumes, of course, that they live to old age…for better or worse, while people in poor health generally don't live as long, we are good enough at keeping them alive even in poor health that their reduced lifespan does not offset the added impacts that their poor health causes over time.)
I assert that not only is climbing the stairs less impactful on the environment in a direct sense, that when one also takes into account the total environmental impact from beginning to end, it's clear that the disparity is even greater.
A: The approach that minimizes CO₂ emission is to go to the elevator, wait until some other people go in it in the same direction, and join them. This way you’ll spend less energy, eat less food and emit less CO₂.
A: There's another problem with your analysis, which the other answers don't seem to stress enough. You say:

However, gravity is a conservative field. The end result in both cases is that I move up one floor, so the amount of work (i.e. energy) required to get me up one floor is independent of the path I take.

If that were true you could go to the moon and then back to the next floor and you'd use the same amount energy as just going to the next floor. Clearly that's not the case or space travel would have been as cheap as going to the next floor (modulo some air-tight elevator). You simply don't get all your energy back on the return trip (from the moon or the next floor) as usable energy due to the second law of thermodynamics.
A: "Better for the environment" is not an objective scientific quantity. To do the comparison you need something more specific like "the one that releases the less CO2".
The lift, depending on its type, releases (indirectly) a quite stable amount of CO2 each time someone uses it. It depends on too many factors to know what it is for this specific lift, but considering such a sign was displayed it is probably not a super-clean model.
When you use the stairs your body indeed uses more energy, but this doesn't necessarily means you will eat more: the human body is wasteful and it requires a significant amount of daily effort to reach the level at which you start to eat more. This means that in most cases climbing those stairs will have literally zero effect on environment.
A: A modern lifestyle assumed (which can be else there wouldn’t be the elevator nor the note) and a person which didn’t have already enough movement (since you agree with the health benefit, I guess you do too), indeed both are true:
Since for health some movement is good anyway, one doesn’t have to consider the calories burned, else the calories may just end up as (possibly unhealthy) fat. 
One could also consider someone doing some exercising in the office after having taking the elevator, so the energy for the elevator is saved for those walking instead of exercising. 
A: There are two conflicting ways to think about this, both with there own adherents:


*

*The work you do is based on renewable energy: food. Even the best elevator uses some electricity, which has environmental impact. Take the stairs!

*Any building with elevators has air handling, and perhaps air cooling. The heat you add going up stairs takes more energy to extract than what’s needed to run the elevator. Take the lift. 
Both of those are over-simplified, which makes the arguments go on and on. 
A: Ok enough with all this theory and philosophy. I had exactly the same question and decided to answer it empirically!
TLDR;

If the elevator is going up anyway, then you should hop on since your
  additional weight has almost no effect on the total power used.
If you are considering taking the elevator alone, you should take the
  stairs.

Note that this advice is based solely on the single hydraulic piston elevator that I tested and may not necessarily apply to all elevators, but interesting findings nonetheless!
Full explanation and data here:
https://wp.josh.com/2013/05/29/elevator-power-usage-should-i-take-the-stairs/
A: There may in fact be a physics answer to this question, but this is a sociological question on other levels.
Taking the stairs when an elevator is available is a behavior with an intent behind it.
If the intent to "be good for the environment" is abandoned because of uncertainty about the magnitude of your act's effectiveness, there's no possibility at all that it can succeed.
Behaviors like this are examples of "thinking globally and acting locally". What's probably (in this case) even more important than the specific amount of energy conserved is the demonstration of your human motivation to try. If you don't set an example, there's no chance that others will follow it. We're not acting alone.
