Price Elasticity of Demand from a CSV
Operator: Abdulla Al Fahad. How tools are built and checked
Across twelve weeks at prices from 4.00 to 5.20, the standard product's unit sales fell about 1.4% for every 1% increase in price, with a 95% interval of -1.49 to -1.28. The premium product, priced from 9.00 to 10.20, moved only -0.5% per 1%. This tool takes a file of prices tried and quantities sold, fits that relationship, and then checks whether the revenue or profit price it implies is somewhere you have actually observed. For a general regression with several predictors, such as price plus season plus promotion, use the Linear Regression tool; this page fits only the log of quantity on the log of price.
Key features
- Log-log OLS elasticity per product with standard error, a 95% t interval, R-squared and the number of observations
- A straight-line demand fit alongside it, for a revenue peak inside the data
- Revenue and profit price checks that say whether the suggested price lies inside the observed range, with warnings for few observations, little price variation, an interval spanning -1, a positive slope and a weak fit
- Arc elasticity between consecutive periods, plus a two-point calculator
- A scatter chart with both fitted curves and the revenue peak marked when it is inside the range
- CSV export, and an XLSX where the logs and the fit are live formulas
How elasticity is estimated, and why the revenue peak is often outside your data
Each row is one observation of a price and the quantity sold at it: a week, a store, a day or an order batch. You choose the price and quantity columns, and optionally a product column (every product with at least three usable rows gets its own fit, up to 30) and a period column. Prices and quantities must be positive, because the model takes logarithms; rows with a blank, zero or negative value are left out and counted in a warning. Currency symbols and thousands commas are accepted. An optional unit cost adds a profit-maximising price.
The period column is used for arc elasticity: within each product the rows of a period are averaged to one price and one quantity, and consecutive periods are compared. Periods that all parse as dates are ordered by date, others by first appearance in the file.
How it works
The model is ln Q = a + b ln P. The slope b is the elasticity: a 1% change in price goes with a b% change in quantity. The standard error comes from the residual variance divided by the spread of ln P, the interval uses the t distribution with n - 2 degrees of freedom, and R-squared is the usual share of variance in ln Q explained. At least three observations and some variation in price are required.
Revenue is price times quantity, which under this model is proportional to P to the power of 1 + b. With b below -1 revenue falls as price rises, so the best revenue in the observed range is at its lowest price; with b above -1 it rises, so the best is at the highest. A constant-elasticity curve has no interior revenue peak, so the result states that there is none instead of inventing one. The straight-line fit Q = alpha + beta P does have a peak, at P = -alpha / (2 beta) when beta is negative, and a note appears if it falls outside the prices you tried.
With a unit cost c, the constant-elasticity profit-maximising price is the markup rule c times b over (1 + b), defined only when b is below -1. The straight-line profit peak is (beta c - alpha) / (2 beta). Arc elasticity between two points is the percentage change in quantity over the percentage change in price, each measured against the midpoint of the two values.
Common use cases
- Putting a number on how price sensitive a product is before a pricing review
- Checking whether a planned price increase sits inside the range of prices you have actually sold at
- Comparing sensitivity across products from a single sales history
How to use this tool
- Upload the file or load the example and check the price and quantity columns.
- Add a product column if the file mixes products, and a period column if you want arc elasticity.
- Add a unit cost if you want a profit price.
- Read the elasticity, its interval and the warnings for the selected product.
- Read the revenue and profit section for whether the suggested prices were ever tried, then download the results.
Example
Twelve weeks for each of two products (load example)
week,product,price,units
W1,Standard,4.00,520
W2,Standard,4.20,498
W3,Standard,4.40,470
W4,Standard,4.60,441
...
W1,Premium,9.00,212
W2,Premium,9.20,209
W3,Premium,9.40,210
...Fits and checks
Standard: elasticity -1.38, 95% interval -1.49 to -1.28, R-squared 0.99, n = 12
Elastic, so revenue is best at the lowest price tried (4.00).
Straight line Q = 1056.6 - 133.9 P peaks at 3.94: below the lowest price tried.
With a unit cost of 2.50 the markup rule gives 9.01: far outside 4.00 to 5.20.
Premium: elasticity -0.51, interval -0.67 to -0.35, R-squared 0.83
Warning: price varied by only 3.9%.
Arc elasticity, Standard, W1 to W2: -0.89
Two-point calculator: price 10 to 12, quantity 100 to 90: -0.58Common pitfalls
This is observational data. If prices moved with promotions, seasons, competitor changes or stock-outs, the slope mixes those effects in, and a positive estimate is the usual sign of this.
Aggregating periods hides variation. Averaging a week's prices when a discount ran two days gives a price that no customer saw.
Elasticity is local. A value of -1.4 near 4.60 says little about what happens at 8.00, which is why a suggested price outside the observed range is marked as one.
- If the interval contains -1, the data cannot say whether a price rise would lift or cut revenue. The tool says so; do not act on the sign of the point estimate.
Common errors and how to fix them
- "Every observation has the same price"
- There is nothing to measure a response to. You need rows at two or more different prices.
Best practices
- Treat the interval, not the point estimate, as the result, and quote it that way.
Frequently asked questions
What does an elasticity of -1.4 mean?
That in this data a 1% higher price went with about 1.4% fewer units sold. Because the drop in units is bigger than the rise in price, revenue falls as price rises across the range observed.
Why are there both log-log and straight-line fits?
The log-log fit gives a constant elasticity, which is easy to read but has no revenue peak. The straight-line fit lets elasticity change along the curve and has a peak, but is a cruder description. Showing both is a check on how much the shape matters.