This is a really tough one and you may as well be asking 'how long is a piece of string?' because there are so many different variables to consider and everyone will be different each time they drink alcohol. It would be great if there was a simple calculator that you could use where you entered some simple details about you and your drinking behaviour on a particular occasion and it would then pump out a time to let you know exactly when you will be sober again (there are online examples of these (e.g., www.whenwillibesober.com) but even these make it clear to users of the site that these are estimates only and they don't accept responsibility for the results).
We usually say that it takes an average adult healthy liver approximately one hour to get rid of one standard drink (i.e., 10 grams of alcohol, e.g., one 30 ml shot of spirits). Many people use this guide and assume that if they have 8 drinks in a session then they will be sober in 8 hours. This 'formula' is often used by people who are considering driving and want to know when they can drive again safely without being over the limit on a breath test. It is important to note that many people who do get busted for drink driving were following this guide - it is not a 'rule', it is simply a guide and one that gets a lot of people into trouble.
The main organ responsible for getting rid of alcohol in the body is the liver. Gender can play a role here, particularly in young people. The most important thing to remember here is that men and women finish developing their livers at different ages. A young man's liver is fully developed at around 18-19 years of age, whereas young women take longer and don't have the ability to process alcohol as effectively until around 21-22 years. Even when fully developed women usually have smaller livers, on average, than men and that could also affect the time it takes for alcohol to be metabolised.
Studies have shown that the time it takes for alcohol to be eliminated from the body (and therefore how long it will take you to sober up) can vary as much as 3-fold from person to person. There is no way of knowing exactly how long it will take but some things that could affect the time period are your gender, your age, whether you're on medication, your health status (particularly your liver health) and how much body fat you're carrying. How fast you sober up is also affected by the type of alcohol you consumed, how fast you drank and how much food you have in your stomach before you started drinking and if you ate while you drank.
So, put simply, there is no way of knowing how long it will take for someone to sober up after drinking alcohol. As much as people love simple answers to complex questions there usually aren't any! If you're going to drink alcohol, particularly if you are going to drink to excess, you need to remember that it's going to take some time to recover and there is absolutely no way of knowing exactly how long that process is going to take!