I have a really bad sharp pain in my left shoulder and under my left rib. Barely slept last night because it hurt so much. It hurts more when I inhale?

Irritant L diaphragm. The clue to the answer is the location (under left rib); the area of referred pain' (left shoulder); the nature of the pain (bad, sharp); and the relation to inhalation, which usually means something on or near the pleura (lining of lung) is being irritated (pleuritic). The most likely cause is a gas pocket stuck in the colon under the left diaphragm (anti-gas pill)or a viral pleurisy--pain rx.