Dcf Valuation Calculator

DCF Valuation Calculator: Estimate Intrinsic Value :root { –primary-color: #004a99; –success-color: #28a745; –background-color: #f8f9fa; –text-color: #333; –border-color: #ccc; –card-background: #fff; –shadow: 0 2px 5px rgba(0,0,0,0.1); } body { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; background-color: var(–background-color); color: var(–text-color); line-height: 1.6; margin: 0; padding: 0; } .container { max-width: 1000px; margin: 20px auto; padding: 20px; background-color: var(–card-background); border-radius: 8px; box-shadow: var(–shadow); } h1, h2, h3 { color: var(–primary-color); text-align: center; margin-bottom: 20px; } h1 { font-size: 2.5em; } h2 { font-size: 1.8em; margin-top: 30px; border-bottom: 2px solid var(–primary-color); padding-bottom: 10px; } h3 { font-size: 1.4em; margin-top: 25px; } .calculator-section { margin-bottom: 40px; padding: 25px; border: 1px solid var(–border-color); border-radius: 8px; background-color: var(–card-background); box-shadow: var(–shadow); } .loan-calc-container { display: flex; flex-direction: column; gap: 20px; } .input-group { display: flex; flex-direction: column; gap: 8px; } .input-group label { font-weight: bold; color: var(–primary-color); } .input-group input[type="number"], .input-group input[type="text"], .input-group select { padding: 12px; border: 1px solid var(–border-color); border-radius: 5px; font-size: 1em; width: 100%; box-sizing: border-box; } .input-group input[type="number"]:focus, .input-group input[type="text"]:focus, .input-group select:focus { outline: none; border-color: var(–primary-color); box-shadow: 0 0 0 3px rgba(0, 74, 153, 0.2); } .input-group .helper-text { font-size: 0.85em; color: #666; } .input-group .error-message { color: red; font-size: 0.8em; margin-top: 5px; display: none; /* Hidden by default */ } .input-group .error-message.visible { display: block; } .button-group { display: flex; gap: 15px; margin-top: 25px; justify-content: center; flex-wrap: wrap; } button { padding: 12px 25px; border: none; border-radius: 5px; font-size: 1em; font-weight: bold; cursor: pointer; transition: background-color 0.3s ease, transform 0.2s ease; color: white; } button.primary { background-color: var(–primary-color); } button.primary:hover { background-color: #003366; transform: translateY(-2px); } button.success { background-color: var(–success-color); } button.success:hover { background-color: #218838; transform: translateY(-2px); } button.secondary { background-color: #6c757d; } button.secondary:hover { background-color: #5a6268; transform: translateY(-2px); } .results-container { margin-top: 30px; padding: 25px; border: 1px solid var(–border-color); border-radius: 8px; background-color: var(–card-background); box-shadow: var(–shadow); text-align: center; } #result { font-size: 2.5em; font-weight: bold; color: var(–primary-color); margin-bottom: 15px; background-color: #e0f2f7; padding: 15px; border-radius: 5px; display: inline-block; min-width: 200px; } .intermediate-results div, .key-assumptions div { margin-bottom: 10px; font-size: 1.1em; } .intermediate-results span, .key-assumptions span { font-weight: bold; color: var(–primary-color); } .formula-explanation { font-size: 0.9em; color: #555; margin-top: 20px; padding: 15px; background-color: #f0f0f0; border-radius: 5px; } table { width: 100%; border-collapse: collapse; margin-top: 25px; box-shadow: var(–shadow); } th, td { padding: 12px 15px; text-align: left; border: 1px solid var(–border-color); } thead { background-color: var(–primary-color); color: white; } tbody tr:nth-child(even) { background-color: #f2f2f2; } caption { font-size: 1.1em; font-weight: bold; color: var(–primary-color); margin-bottom: 10px; caption-side: top; text-align: left; } canvas { display: block; margin: 25px auto; max-width: 100%; border: 1px solid var(–border-color); border-radius: 5px; background-color: var(–card-background); } .article-content { margin-top: 40px; padding: 25px; border: 1px solid var(–border-color); border-radius: 8px; background-color: var(–card-background); box-shadow: var(–shadow); } .article-content p, .article-content ul, .article-content ol { margin-bottom: 15px; } .article-content li { margin-bottom: 8px; } .article-content a { color: var(–primary-color); text-decoration: none; } .article-content a:hover { text-decoration: underline; } .faq-item { margin-bottom: 15px; padding: 15px; background-color: #f0f0f0; border-radius: 5px; } .faq-item strong { color: var(–primary-color); display: block; margin-bottom: 5px; } .related-tools ul { list-style: none; padding: 0; } .related-tools li { margin-bottom: 10px; } .related-tools a { font-weight: bold; } .related-tools span { font-size: 0.9em; color: #555; display: block; margin-top: 3px; } .highlighted-result { background-color: var(–success-color); color: white; padding: 10px 20px; border-radius: 5px; font-size: 1.2em; font-weight: bold; display: inline-block; margin-top: 10px; } .chart-container { position: relative; width: 100%; height: 300px; /* Adjust as needed */ margin-top: 20px; } .chart-legend { display: flex; justify-content: center; gap: 20px; margin-top: 10px; flex-wrap: wrap; } .chart-legend-item { display: flex; align-items: center; gap: 5px; } .chart-legend-item::before { content: "; display: inline-block; width: 15px; height: 15px; border-radius: 3px; } .chart-legend-item.series1::before { background-color: #004a99; } .chart-legend-item.series2::before { background-color: #28a745; } .chart-legend-item.series3::before { background-color: #ffc107; }

DCF Valuation Calculator

Estimate the intrinsic value of a company using the Discounted Cash Flow (DCF) model.

DCF Valuation Inputs

Enter the company's most recent annual revenue.
Enter the expected annual growth rate for revenue (as a percentage).
Enter the company's net profit margin (as a percentage).
Weighted Average Cost of Capital (WACC) representing the required rate of return (as a percentage).
The perpetual growth rate of cash flows beyond the projection period (as a percentage).
Number of years for explicit cash flow projections.
Total number of outstanding shares of the company.

DCF Valuation Results

Key Intermediate Values

Projected Free Cash Flow (Year 1):
Terminal Value:
Total Enterprise Value:

Key Assumptions

Discount Rate (WACC):
Terminal Growth Rate:
Projection Years:
Formula Explanation: DCF valuation estimates a company's value by projecting its future free cash flows (FCF) and discounting them back to their present value using a discount rate (WACC). A terminal value is calculated for cash flows beyond the explicit projection period, and the sum of these present values represents the company's Enterprise Value. This is then adjusted for debt and cash to arrive at Equity Value, and finally divided by outstanding shares to get the intrinsic value per share.

Projected Free Cash Flow vs. Discounted Cash Flow

Projected FCF
Discounted FCF
Projected Free Cash Flows and their Present Values over the projection period.

DCF Projection Details

Year Projected Revenue Net Profit (FCF) Discount Factor Present Value of FCF
Enter inputs and click 'Calculate DCF' to see details.
Detailed breakdown of projected cash flows and their present values.

What is DCF Valuation?

DCF valuation, or Discounted Cash Flow valuation, is a fundamental method used in finance to estimate the intrinsic value of an investment based on its expected future cash flows. The core principle is that the value of a company or asset today is equivalent to the sum of all the cash it is expected to generate in the future, adjusted for the time value of money and risk. This means that a dollar received in the future is worth less than a dollar received today. The DCF valuation method is widely regarded as one of the most theoretically sound approaches to valuation, as it directly links a company's value to its ability to generate cash.

Who Should Use DCF Valuation?

DCF valuation is a powerful tool primarily used by:

  • Investors: Both individual and institutional investors use DCF to determine if a stock is undervalued, fairly valued, or overvalued. By comparing the calculated intrinsic value to the current market price, investors can make informed buy/sell decisions.
  • Financial Analysts: Equity research analysts and investment bankers rely heavily on DCF models to value companies for mergers, acquisitions, initial public offerings (IPOs), and fairness opinions.
  • Business Owners and Managers: Companies can use DCF to assess the viability of new projects, evaluate potential acquisitions, or understand the overall value drivers of their own business.
  • Academics and Students: It's a cornerstone concept in finance education, teaching the principles of time value of money, risk assessment, and future cash flow forecasting.

Common Misconceptions about DCF Valuation

Despite its theoretical soundness, DCF valuation is often misunderstood:

  • It's an exact science: DCF is an estimate. Its accuracy is highly dependent on the quality of the assumptions made about future growth, profitability, and discount rates. Small changes in these assumptions can lead to significant variations in the final valuation.
  • It only works for stable companies: While DCF is best suited for companies with predictable cash flows, it can be adapted for high-growth or cyclical businesses, though it becomes more complex and sensitive to assumptions.
  • It ignores market sentiment: DCF focuses on intrinsic value, not market price. A stock can be trading significantly above or below its DCF-derived value due to market sentiment, speculation, or other factors.
  • Future cash flows are guaranteed: Projections are inherently uncertain. DCF models are built on educated guesses about the future, not certainties.

DCF Valuation Formula and Mathematical Explanation

The DCF valuation process involves several steps, culminating in the calculation of intrinsic value per share. The core components are projecting future Free Cash Flows (FCF), calculating a Terminal Value, and discounting all future cash flows back to the present.

Step 1: Project Free Cash Flows (FCF)

FCF represents the cash a company generates after accounting for expenses, taxes, and investments in operating assets (like property, plant, and equipment). A common way to calculate FCF is:

FCF = Net Income + Depreciation & Amortization - Capital Expenditures - Change in Working Capital

For simplicity in this calculator, we approximate FCF based on projected revenue and profit margin:

Projected FCF (Year n) = Projected Revenue (Year n) * Net Profit Margin

Projected Revenue for year 'n' is calculated iteratively:

Projected Revenue (Year n) = Current Revenue * (1 + Revenue Growth Rate)^n

Step 2: Calculate Terminal Value (TV)

Since a company is assumed to operate indefinitely, we need to estimate the value of cash flows beyond the explicit projection period. The most common method is the Gordon Growth Model (Perpetuity Growth Model):

Terminal Value = FCF (Year n+1) / (Discount Rate - Terminal Growth Rate)

Where FCF (Year n+1) is the FCF in the first year after the explicit projection period.

FCF (Year n+1) = FCF (Last Projection Year) * (1 + Terminal Growth Rate)

Step 3: Discount Future Cash Flows and Terminal Value

Each projected FCF and the Terminal Value are discounted back to their present value using the discount rate (WACC). The formula for the present value (PV) of a single future cash flow is:

PV = Cash Flow / (1 + Discount Rate)^n

Where 'n' is the year in which the cash flow occurs.

Step 4: Calculate Total Enterprise Value (TEV)

The TEV is the sum of the present values of all projected FCFs and the present value of the Terminal Value.

Total Enterprise Value = Σ [FCF (Year n) / (1 + Discount Rate)^n] + [Terminal Value / (1 + Discount Rate)^N]

Where N is the last year of the explicit projection period.

Step 5: Calculate Equity Value and Intrinsic Value Per Share

To get the value attributable to shareholders (Equity Value), we adjust the TEV:

Equity Value = Total Enterprise Value - Total Debt + Cash & Cash Equivalents

(Note: This calculator simplifies by assuming TEV is directly used to derive per-share value, omitting explicit debt/cash adjustments for clarity, which is common in simplified DCF models focusing on operational cash generation.)

Finally, the intrinsic value per share is calculated:

Intrinsic Value Per Share = Equity Value / Current Outstanding Shares

Variables Table

Variable Meaning Unit Typical Range
Current Annual Revenue The company's revenue in the most recent fiscal year. Currency (e.g., USD) Varies widely by company size
Projected Revenue Growth Rate The expected annual percentage increase in revenue. Percentage (%) 1% – 20% (higher for growth companies, lower for mature)
Net Profit Margin Net income as a percentage of revenue. Percentage (%) 2% – 30%+ (varies by industry)
Discount Rate (WACC) Required rate of return, reflecting risk. Percentage (%) 8% – 15% (higher risk = higher rate)
Terminal Growth Rate Perpetual growth rate assumed after projections. Percentage (%) 1% – 4% (typically below long-term economic growth)
Number of Projection Years Duration of explicit cash flow forecasts. Years 3 – 10 years
Current Outstanding Shares Total number of shares issued. Count Varies widely
Projected FCF Free Cash Flow projected for a specific year. Currency Derived from inputs
Terminal Value Estimated value of cash flows beyond projection period. Currency Derived from inputs
Total Enterprise Value Sum of PV of FCFs and PV of Terminal Value. Currency Derived from inputs
Intrinsic Value Per Share Estimated value of one share of common stock. Currency Derived from inputs

Practical Examples (Real-World Use Cases)

Example 1: Valuing a Mature Tech Company

Scenario: 'StableTech Inc.' is a well-established software company with predictable revenues.

Inputs:

  • Current Annual Revenue: $500,000,000
  • Projected Revenue Growth Rate: 4%
  • Net Profit Margin: 20%
  • Discount Rate (WACC): 9%
  • Terminal Growth Rate: 2.5%
  • Number of Projection Years: 5
  • Current Outstanding Shares: 10,000,000

Calculation (Simplified):

  • Year 1 FCF: $500M * (1.04)^1 * 0.20 = $10.4M
  • … (projections for years 2-5)
  • Year 5 FCF: $500M * (1.04)^5 * 0.20 = $12.17M
  • FCF Year 6: $12.17M * (1 + 0.025) = $12.47M
  • Terminal Value: $12.47M / (0.09 – 0.025) = $191.8M
  • Sum of PV of FCFs (Years 1-5): Approx. $47.5M
  • PV of Terminal Value: $191.8M / (1.09)^5 = Approx. $125.5M
  • Total Enterprise Value: $47.5M + $125.5M = $173M
  • Intrinsic Value Per Share: $173M / 10M shares = $17.30

Interpretation: Based on these assumptions, StableTech Inc. has an intrinsic value of $17.30 per share. An investor might consider buying the stock if it's trading significantly below this price.

Example 2: Valuing a High-Growth Startup

Scenario: 'InnovateX Corp.' is a rapidly growing tech startup with high revenue potential but lower current margins.

Inputs:

  • Current Annual Revenue: $50,000,000
  • Projected Revenue Growth Rate: 25%
  • Net Profit Margin: 8%
  • Discount Rate (WACC): 12%
  • Terminal Growth Rate: 3%
  • Number of Projection Years: 7
  • Current Outstanding Shares: 5,000,000

Calculation (Simplified):

  • Year 1 FCF: $50M * (1.25)^1 * 0.08 = $5.0M
  • … (projections for years 2-7)
  • Year 7 FCF: $50M * (1.25)^7 * 0.08 = $24.4M
  • FCF Year 8: $24.4M * (1 + 0.03) = $25.1M
  • Terminal Value: $25.1M / (0.12 – 0.03) = $278.9M
  • Sum of PV of FCFs (Years 1-7): Approx. $75.2M
  • PV of Terminal Value: $278.9M / (1.12)^7 = Approx. $127.1M
  • Total Enterprise Value: $75.2M + $127.1M = $202.3M
  • Intrinsic Value Per Share: $202.3M / 5M shares = $40.46

Interpretation: InnovateX Corp. shows a higher intrinsic value per share ($40.46) due to its aggressive growth assumptions. However, the higher discount rate reflects the increased risk associated with such a high-growth venture. Sensitivity analysis on growth and discount rates would be crucial here.

How to Use This DCF Valuation Calculator

Our DCF Valuation Calculator simplifies the complex process of estimating a company's intrinsic value. Follow these steps:

  1. Gather Inputs: Collect the necessary financial data for the company you wish to value. This includes current revenue, expected growth rates, profit margins, your required rate of return (discount rate), a long-term growth assumption (terminal rate), the number of years you want to project explicitly, and the current number of outstanding shares.
  2. Enter Data: Input the gathered figures into the respective fields in the calculator. Ensure you enter percentages as whole numbers (e.g., 10 for 10%).
  3. Validate Inputs: The calculator will perform inline validation. Check for any error messages below the input fields and correct them. Ensure all values are positive numbers and within reasonable ranges where applicable.
  4. Calculate: Click the "Calculate DCF" button. The calculator will process your inputs and display the estimated intrinsic value per share.
  5. Review Results: Examine the primary result (Intrinsic Value Per Share) and the intermediate values like Projected FCF, Terminal Value, and Total Enterprise Value. Understand the key assumptions used in the calculation.
  6. Analyze the Table and Chart: The detailed table shows the year-by-year breakdown of projected cash flows and their present values. The chart visually represents the growth of projected FCF and its discounted value over time.
  7. Interpret the Value: Compare the calculated intrinsic value per share to the company's current market price. If the intrinsic value is significantly higher, the stock may be undervalued. If it's lower, it might be overvalued.
  8. Use 'Copy Results': If you need to share your findings or use them elsewhere, click "Copy Results" to copy the main valuation figure, intermediate values, and key assumptions to your clipboard.
  9. Reset: Use the "Reset" button to clear all fields and start over with new inputs.

Decision-Making Guidance: Remember that DCF is a tool, not a crystal ball. Use the results as a guide alongside other valuation methods and qualitative analysis. Consider performing sensitivity analysis by changing key assumptions (like discount rate or growth rate) to understand how the valuation changes under different scenarios.

Key Factors That Affect DCF Valuation Results

The output of a DCF valuation is highly sensitive to the inputs. Several key factors significantly influence the final intrinsic value:

  1. Revenue Growth Rate: Higher projected revenue growth leads to higher future cash flows, thus increasing the company's value. Overly optimistic growth assumptions are a common pitfall.
  2. Profit Margins: A higher net profit margin means more of each revenue dollar translates into profit, directly boosting FCF and valuation. Industry norms and competitive pressures dictate realistic margins.
  3. Discount Rate (WACC): This is arguably the most critical input. A higher discount rate (reflecting higher perceived risk or opportunity cost) significantly reduces the present value of future cash flows, lowering the valuation. Conversely, a lower discount rate increases the valuation.
  4. Terminal Growth Rate: This rate determines the value of the company beyond the explicit forecast period. A rate that is too high can disproportionately inflate the terminal value and overall valuation. It should generally be conservative, often aligned with long-term GDP growth.
  5. Projection Period Length: Extending the explicit projection period can increase value if cash flows are positive and growing, but it also increases the uncertainty. Shorter periods rely more heavily on the terminal value assumption.
  6. Capital Expenditures (CapEx) & Working Capital: While simplified in this calculator, actual FCF calculations heavily depend on investments in long-term assets (CapEx) and changes in short-term assets/liabilities (Working Capital). Higher CapEx and working capital needs reduce FCF.
  7. Inflation: Inflation affects both revenues and costs. While higher revenues might seem good, if costs rise faster, margins can shrink. The discount rate should also implicitly account for inflation expectations.
  8. Economic Conditions: Broader economic factors like recessions, interest rate changes, and geopolitical events impact future growth prospects and risk, influencing revenue projections and the discount rate.

Frequently Asked Questions (FAQ)

Q1: What is the difference between Enterprise Value and Equity Value in DCF?

Enterprise Value (EV) represents the total value of the company's core operations, attributable to all capital providers (debt and equity holders). Equity Value is the portion attributable specifically to shareholders. It's calculated as EV minus Net Debt (Total Debt – Cash & Equivalents).

Q2: Why is the Discount Rate so important in DCF?

The discount rate (often WACC) reflects the riskiness of the investment and the opportunity cost of capital. Because future cash flows are discounted exponentially, even small changes in the discount rate can have a large impact on the present value, making it a highly sensitive input.

Q3: Can DCF be used for companies with negative cash flows?

Yes, but it's more challenging. You would project the negative cash flows (losses) and then estimate when the company might become cash-flow positive. The terminal value calculation would likely need significant adjustments or alternative methods.

Q4: How accurate is a DCF valuation?

DCF is theoretically sound but practically an estimate. Its accuracy depends heavily on the quality and realism of the assumptions. It's best used as one input among several valuation methods.

Q5: What is the Gordon Growth Model for Terminal Value?

It's a method to estimate the value of a company's cash flows beyond the explicit forecast period, assuming they grow at a constant, perpetual rate (the terminal growth rate). It's widely used but relies on the assumption of stable, perpetual growth.

Q6: Should I use Net Income or Free Cash Flow in DCF?

Free Cash Flow (FCF) is preferred because it represents the actual cash available to the company's investors after all necessary operating expenses and investments are made. Net Income can be affected by non-cash items and accounting choices.

Q7: What if the Terminal Growth Rate is higher than the Discount Rate?

If the terminal growth rate exceeds the discount rate, the Gordon Growth Model yields a negative or infinite terminal value, which is nonsensical. This indicates an unsustainable assumption – the company cannot grow faster than the discount rate indefinitely. The terminal growth rate should always be less than the discount rate.

Q8: How do I handle taxes in DCF?

Taxes are typically incorporated into the FCF calculation. For instance, Net Operating Profit After Tax (NOPAT) is often used as a starting point before accounting for depreciation and CapEx. In simpler models, using Net Income (which is post-tax) and adjusting it can approximate FCF.

var chartInstance = null; function formatCurrency(value) { if (isNaN(value) || value === null) return "–"; return "$" + value.toFixed(2).replace(/\d(?=(\d{3})+\.)/g, '$&,'); } function formatNumber(value) { if (isNaN(value) || value === null) return "–"; return value.toFixed(2).replace(/\d(?=(\d{3})+\.)/g, '$&,'); } function formatPercentage(value) { if (isNaN(value) || value === null) return "–"; return value.toFixed(2) + "%"; } function clearErrors() { var errorElements = document.querySelectorAll('.error-message'); for (var i = 0; i < errorElements.length; i++) { errorElements[i].classList.remove('visible'); errorElements[i].textContent = ''; } } function validateInput(id, min, max) { var input = document.getElementById(id); var value = parseFloat(input.value); var errorElement = document.getElementById(id + 'Error'); var isValid = true; if (input.value === "") { errorElement.textContent = "This field cannot be empty."; isValid = false; } else if (isNaN(value)) { errorElement.textContent = "Please enter a valid number."; isValid = false; } else if (min !== undefined && value max) { errorElement.textContent = "Value cannot be greater than " + max + "."; isValid = false; } else { errorElement.textContent = "; } if (isValid) { errorElement.classList.remove('visible'); } else { errorElement.classList.add('visible'); } return isValid; } function calculateDCF() { clearErrors(); var isValid = true; isValid &= validateInput('currentRevenue', 0); isValid &= validateInput('revenueGrowthRate', -100, 100); // Allow negative growth, but cap isValid &= validateInput('profitMargin', 0, 100); isValid &= validateInput('discountRate', 0.1, 100); // Discount rate must be > 0.1% isValid &= validateInput('terminalGrowthRate', -100, 100); isValid &= validateInput('projectionYears', 1, 50); isValid &= validateInput('currentShares', 1); if (!isValid) { document.getElementById('result').textContent = "–"; updateIntermediateResults("–", "–", "–"); updateAssumptions("–", "–", "–"); clearTable(); updateChart([], []); return; } var currentRevenue = parseFloat(document.getElementById('currentRevenue').value); var revenueGrowthRate = parseFloat(document.getElementById('revenueGrowthRate').value) / 100; var profitMargin = parseFloat(document.getElementById('profitMargin').value) / 100; var discountRate = parseFloat(document.getElementById('discountRate').value) / 100; var terminalGrowthRate = parseFloat(document.getElementById('terminalGrowthRate').value) / 100; var projectionYears = parseInt(document.getElementById('projectionYears').value); var currentShares = parseFloat(document.getElementById('currentShares').value); // — Input Validation Edge Cases — if (discountRate <= terminalGrowthRate) { var errorElement = document.getElementById('terminalGrowthRateError'); errorElement.textContent = "Terminal growth rate must be less than the discount rate."; errorElement.classList.add('visible'); isValid = false; } if (currentShares <= 0) { var errorElement = document.getElementById('currentSharesError'); errorElement.textContent = "Current shares must be greater than zero."; errorElement.classList.add('visible'); isValid = false; } if (currentRevenue <= 0) { var errorElement = document.getElementById('currentRevenueError'); errorElement.textContent = "Current revenue must be greater than zero."; errorElement.classList.add('visible'); isValid = false; } if (!isValid) { document.getElementById('result').textContent = "–"; updateIntermediateResults("–", "–", "–"); updateAssumptions("–", "–", "–"); clearTable(); updateChart([], []); return; } var projectedFcfYear1 = currentRevenue * (1 + revenueGrowthRate) * profitMargin; var totalFcfPv = 0; var fcfData = []; var pvFcfData = []; var revenueData = []; for (var i = 1; i <= projectionYears; i++) { var currentYearRevenue = currentRevenue * Math.pow(1 + revenueGrowthRate, i); var currentYearFcf = currentYearRevenue * profitMargin; var discountFactor = 1 / Math.pow(1 + discountRate, i); var pvFcf = currentYearFcf * discountFactor; totalFcfPv += pvFcf; fcfData.push(currentYearFcf); pvFcfData.push(pvFcf); revenueData.push(currentYearRevenue); addTableRow(i, currentYearRevenue, currentYearFcf, discountFactor, pvFcf); } var lastFcf = fcfData[fcfData.length – 1]; var nextFcf = lastFcf * (1 + terminalGrowthRate); var terminalValue = nextFcf / (discountRate – terminalGrowthRate); var terminalValuePv = terminalValue / Math.pow(1 + discountRate, projectionYears); var totalEnterpriseValue = totalFcfPv + terminalValuePv; var intrinsicValuePerShare = totalEnterpriseValue / currentShares; // Display results document.getElementById('result').textContent = formatCurrency(intrinsicValuePerShare); updateIntermediateResults(formatCurrency(projectedFcfYear1), formatCurrency(terminalValue), formatCurrency(totalEnterpriseValue)); updateAssumptions(formatPercentage(discountRate), formatPercentage(terminalGrowthRate), projectionYears); updateChart(revenueData, pvFcfData); // Charting Revenue vs PV of FCF for comparison } function updateIntermediateResults(fcf1, tv, tev) { document.getElementById('projectedFcf').innerHTML = 'Projected Free Cash Flow (Year 1): ' + fcf1 + ''; document.getElementById('terminalValue').innerHTML = 'Terminal Value: ' + tv + ''; document.getElementById('totalEnterpriseValue').innerHTML = 'Total Enterprise Value: ' + tev + ''; } function updateAssumptions(dr, tgr, py) { document.getElementById('assumedDiscountRate').innerHTML = 'Discount Rate (WACC): ' + dr + ''; document.getElementById('assumedTerminalGrowth').innerHTML = 'Terminal Growth Rate: ' + tgr + ''; document.getElementById('assumedProjectionYears').innerHTML = 'Projection Years: ' + py + ''; } function addTableRow(year, revenue, fcf, discountFactor, pvFcf) { var tableBody = document.getElementById('dcfTableBody'); var row = tableBody.insertRow(); row.innerHTML = '' + year + '' + '' + formatCurrency(revenue) + '' + '' + formatCurrency(fcf) + '' + '' + formatPercentage(discountFactor) + '' + '' + formatCurrency(pvFcf) + ''; } function clearTable() { var tableBody = document.getElementById('dcfTableBody'); tableBody.innerHTML = 'Enter inputs and click \'Calculate DCF\' to see details.'; } function resetForm() { document.getElementById('currentRevenue').value = "10000000"; document.getElementById('revenueGrowthRate').value = "5"; document.getElementById('profitMargin').value = "15"; document.getElementById('discountRate').value = "10"; document.getElementById('terminalGrowthRate').value = "3"; document.getElementById('projectionYears').value = "5"; document.getElementById('currentShares').value = "1000000"; clearErrors(); calculateDCF(); // Recalculate with defaults } function copyResults() { var mainResult = document.getElementById('result').textContent; var projectedFcf = document.getElementById('projectedFcf').textContent.replace('Projected Free Cash Flow (Year 1): ', "); var terminalValue = document.getElementById('terminalValue').textContent.replace('Terminal Value: ', "); var totalEnterpriseValue = document.getElementById('totalEnterpriseValue').textContent.replace('Total Enterprise Value: ', "); var discountRate = document.getElementById('assumedDiscountRate').textContent.replace('Discount Rate (WACC): ', "); var terminalGrowth = document.getElementById('assumedTerminalGrowth').textContent.replace('Terminal Growth Rate: ', "); var projectionYears = document.getElementById('assumedProjectionYears').textContent.replace('Projection Years: ', "); var assumptions = "Key Assumptions:\n" + "- Discount Rate (WACC): " + discountRate + "\n" + "- Terminal Growth Rate: " + terminalGrowth + "\n" + "- Projection Years: " + projectionYears; var resultsText = "DCF Valuation Results:\n" + "Intrinsic Value Per Share: " + mainResult + "\n" + "Projected FCF (Year 1): " + projectedFcf + "\n" + "Terminal Value: " + terminalValue + "\n" + "Total Enterprise Value: " + totalEnterpriseValue + "\n\n" + assumptions; navigator.clipboard.writeText(resultsText).then(function() { // Optional: Show a confirmation message var copyButton = document.querySelector('button.success'); copyButton.textContent = 'Copied!'; setTimeout(function() { copyButton.textContent = 'Copy Results'; }, 2000); }).catch(function(err) { console.error('Failed to copy results: ', err); // Optional: Show an error message }); } function updateChart(revenues, pvFcfs) { var ctx = document.getElementById('dcfChart').getContext('2d'); // Destroy previous chart instance if it exists if (chartInstance) { chartInstance.destroy(); } // Prepare data for chart var labels = []; var revenueData = []; var pvFcfData = []; // Ensure we have data points up to the max of either array length var maxPoints = Math.max(revenues.length, pvFcfs.length); for (var i = 0; i = 1000000) { return '$' + (value / 1000000).toFixed(1) + 'M'; } else if (value >= 1000) { return '$' + (value / 1000).toFixed(1) + 'K'; } return '$' + value.toFixed(0); } } } }, plugins: { tooltip: { callbacks: { label: function(context) { var label = context.dataset.label || "; if (label) { label += ': '; } if (context.parsed.y !== null) { label += formatCurrency(context.parsed.y); } return label; } } } } } }); } // Initial calculation on page load with default values window.onload = function() { resetForm(); // Load defaults and calculate };

Leave a Comment