If you just want to work out, then the YMCA is probably not efficient for you. If you want the programs associated with the YMCA as well as access to the gym, the extra cost is worth it.
For example, at our local YMCA, my two daughters take karate, swim on the swim team, and play on the basketball team. We take advantage of these at a large discount the general public does not receive. MY kids also stay in the kid zone while I work out (yoga, spin, etc), and go to parents night out once a month. They used to do day summer camps at the Y. IT's like a community center, so that's what you're paying for.