Yes somewhat… the formula has several factors that are constantly in flux, Bitcoin mining is a random process the value can be off entirely by chance. But it’s designed to self-adjust over the long run towards that formula, individual fluctuations cancel out in the long run.
For electricity price specifically, wholesale prices of electricity tend to be fairly close everywhere bitcoin is mined. Bitcoin mining is more profitable where electricity is the cheapest and is uneconomic in places where the price of electricity is above average. So it only happens where the wholesale price is globally competitive.
You’re not wrong.
Wholesale prices do bounce around significantly in a day, occasionally even going negative. And some miners do shutdown for brief periods during high demand due to a high electricity price. Some miners aren’t buying electricity from the grid, and have their own generation sources with different economic inputs. And there’s lots of day to day volatility in mining rates that has nothing to do with economics.
There’s no formula or methodology that could tell you how much energy is being wasted at any given moment. That impossible. There’s no way of knowing how many miners are operating globally at any given point in time. We can’t even reliably tell which country a block was mined in. We can only make reasonable estimates of global averages over the last few weeks.
You can get closer with more detailed modelling, but the equation I gave using global averages for bitcoin and electricity prices in the last few weeks will get you to an accurate estimate.