How to Calculate the Weighted Average Cost

How to Calculate Weighted Average Cost (WACC) – Your Definitive Guide & Calculator :root { –primary-color: #004a99; –success-color: #28a745; –background-color: #f8f9fa; –text-color: #333; –light-gray: #e9ecef; –white: #fff; –border-radius: 8px; –shadow: 0 4px 12px rgba(0, 0, 0, 0.08); } body { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; background-color: var(–background-color); color: var(–text-color); line-height: 1.7; margin: 0; padding: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 100vh; } .container { width: 95%; max-width: 1000px; margin: 20px auto; padding: 30px; background-color: var(–white); border-radius: var(–border-radius); box-shadow: var(–shadow); } header { background-color: var(–primary-color); color: var(–white); padding: 20px 30px; border-top-left-radius: var(–border-radius); border-top-right-radius: var(–border-radius); text-align: center; margin: -30px -30px 30px -30px; } h1, h2, h3, h4 { color: var(–primary-color); margin-bottom: 15px; line-height: 1.4; } h1 { font-size: 2.5em; margin-bottom: 20px; } h2 { font-size: 1.8em; margin-top: 30px; border-bottom: 2px solid var(–light-gray); padding-bottom: 8px; } h3 { font-size: 1.4em; margin-top: 25px; } .calculator-section { background-color: var(–white); padding: 30px; border-radius: var(–border-radius); box-shadow: var(–shadow); margin-bottom: 40px; } .calculator-section h2 { text-align: center; margin-top: 0; margin-bottom: 30px; } .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); font-size: 0.95em; } .input-group input[type="number"], .input-group input[type="text"], .input-group select { padding: 12px 15px; border: 1px solid var(–light-gray); border-radius: var(–border-radius); font-size: 1em; box-sizing: border-box; width: 100%; } .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 2px rgba(0, 74, 153, 0.2); } .input-group .helper-text { font-size: 0.85em; color: #6c757d; margin-top: 4px; } .input-group .error-message { color: #dc3545; font-size: 0.85em; margin-top: 5px; display: none; /* Hidden by default */ } .input-group.error input[type="number"], .input-group.error input[type="text"], .input-group.error select { border-color: #dc3545; } .input-group.error .error-message { display: block; /* Shown when error class is present */ } .button-group { display: flex; gap: 15px; margin-top: 25px; justify-content: center; flex-wrap: wrap; } .button-group button { padding: 12px 25px; border: none; border-radius: var(–border-radius); cursor: pointer; font-size: 1em; font-weight: bold; transition: background-color 0.3s ease, transform 0.2s ease; } .button-group .calculate-btn { background-color: var(–primary-color); color: var(–white); } .button-group .calculate-btn:hover { background-color: #003366; transform: translateY(-2px); } .button-group .reset-btn { background-color: #6c757d; color: var(–white); } .button-group .reset-btn:hover { background-color: #5a6268; transform: translateY(-2px); } .button-group .copy-btn { background-color: var(–success-color); color: var(–white); } .button-group .copy-btn:hover { background-color: #218838; transform: translateY(-2px); } .results-container { margin-top: 30px; padding: 25px; background-color: var(–light-gray); border-radius: var(–border-radius); text-align: center; border-left: 5px solid var(–primary-color); } .results-container h3 { margin-top: 0; color: var(–primary-color); font-size: 1.5em; } .primary-result { font-size: 2.2em; font-weight: bold; color: var(–primary-color); margin: 15px 0; display: inline-block; padding: 10px 20px; background-color: rgba(0, 74, 153, 0.1); border-radius: var(–border-radius); } .intermediate-results { display: flex; justify-content: center; gap: 25px; margin-top: 20px; flex-wrap: wrap; } .intermediate-results div { text-align: center; background-color: var(–white); padding: 15px; border-radius: var(–border-radius); box-shadow: 0 2px 5px rgba(0,0,0,0.05); min-width: 150px; } .intermediate-results span { display: block; font-size: 1.8em; font-weight: bold; color: var(–primary-color); } .intermediate-results p { font-size: 0.9em; margin: 5px 0 0 0; color: #555; } .formula-explanation { margin-top: 25px; font-size: 0.95em; color: #555; text-align: left; } .chart-container, .table-container { margin-top: 30px; padding: 25px; background-color: var(–white); border-radius: var(–border-radius); box-shadow: var(–shadow); } .chart-container h3, .table-container h3 { text-align: center; margin-top: 0; } canvas { width: 100%; height: 350px; } table { width: 100%; border-collapse: collapse; margin-top: 15px; } thead { background-color: var(–primary-color); color: var(–white); } th, td { padding: 12px 15px; text-align: left; border: 1px solid var(–light-gray); } tbody tr:nth-child(even) { background-color: var(–light-gray); } td.currency, td.percentage { text-align: right; } .article-content { margin-top: 40px; padding: 30px; background-color: var(–white); border-radius: var(–border-radius); box-shadow: var(–shadow); } .article-content h2 { margin-top: 0; } .article-content p, .article-content ul, .article-content ol { margin-bottom: 20px; font-size: 1.05em; } .article-content ul, .article-content ol { padding-left: 30px; } .article-content li { margin-bottom: 10px; } .article-content a { color: var(–primary-color); text-decoration: none; font-weight: bold; } .article-content a:hover { text-decoration: underline; } .faq-section .faq-item { margin-bottom: 20px; padding: 15px; background-color: var(–light-gray); border-radius: var(–border-radius); } .faq-section .faq-item h3 { margin-bottom: 8px; font-size: 1.1em; cursor: pointer; position: relative; padding-left: 25px; } .faq-section .faq-item h3:before { content: '+'; position: absolute; left: 5px; font-weight: bold; color: var(–primary-color); font-size: 1.2em; } .faq-section .faq-item.active h3:before { content: '-'; } .faq-section .faq-item .faq-answer { display: none; margin-top: 10px; padding-left: 10px; border-left: 3px solid var(–primary-color); font-size: 0.95em; color: #555; } .faq-section .faq-item.active .faq-answer { display: block; } .related-tools { margin-top: 30px; padding: 25px; background-color: var(–white); border-radius: var(–border-radius); box-shadow: var(–shadow); } .related-tools h3 { text-align: center; margin-top: 0; } .related-tools ul { list-style: none; padding: 0; } .related-tools li { margin-bottom: 15px; border-bottom: 1px dashed var(–light-gray); padding-bottom: 10px; } .related-tools li:last-child { border-bottom: none; } .related-tools a { font-weight: bold; color: var(–primary-color); text-decoration: none; } .related-tools a:hover { text-decoration: underline; } .related-tools p { font-size: 0.9em; color: #555; margin-top: 5px; } footer { text-align: center; margin-top: 40px; padding: 20px; font-size: 0.85em; color: #777; width: 100%; } @media (min-width: 768px) { .container { margin: 40px auto; } .button-group { justify-content: center; } .intermediate-results { justify-content: space-around; } }

How to Calculate Weighted Average Cost of Capital (WACC)

Unlock the Power of WACC for Strategic Financial Decisions

Weighted Average Cost of Capital (WACC) Calculator

Total market capitalization of outstanding shares.
Expected rate of return for equity investors.
Total market value of all outstanding debt (bonds, loans).
The current interest rate your company pays on its debt.
Your company's effective corporate tax rate.

Weighted Average Cost of Capital (WACC)

–.–%
–.–%

Weight of Equity

–.–%

Weight of Debt

–.–%

After-Tax Cost of Debt

Formula Used: WACC = (E/V * Re) + (D/V * Rd * (1 – Tc))
Where:
E = Market Value of Equity
D = Market Value of Debt
V = Total Market Value of Company (E + D)
Re = Cost of Equity
Rd = Interest Rate on Debt
Tc = Corporate Tax Rate

WACC Component Breakdown

Visual representation of the contribution of equity and debt to the overall WACC.

WACC Components Summary

Component Value Weight Cost After-Tax Cost
Equity –.–% –.–% –.–%
Debt –.–% –.–% –.–%
Total / WACC 100.00% –.–%

What is the Weighted Average Cost of Capital (WACC)?

The Weighted Average Cost of Capital (WACC) is a fundamental financial metric used to represent a company's blended cost of financing its assets. It is calculated by taking the cost of each capital component—equity, debt, and preferred stock (if applicable)—and weighting them according to their proportionate use in the company's capital structure. Essentially, WACC represents the minimum rate of return a company must earn on its existing asset base to satisfy its creditors, owners, and other providers of capital. Understanding how to calculate the weighted average cost is crucial for any business evaluating investment opportunities, mergers, or acquisitions, as it provides a benchmark for expected returns.

Who Should Use It?
WACC is primarily used by financial analysts, corporate finance managers, investors, and business owners. It's indispensable for:

  • Corporate Investment Decisions: Companies use WACC as the discount rate in Net Present Value (NPV) calculations for new projects. If a project's expected return exceeds the WACC, it is generally considered value-adding.
  • Valuation: WACC is a key input in Discounted Cash Flow (DCF) models for business valuation.
  • Capital Structure Optimization: Management can analyze how changes in the debt-to-equity mix affect the overall cost of capital.
  • Performance Measurement: Comparing a company's return on invested capital (ROIC) to its WACC indicates operational efficiency and value creation.

Common Misconceptions About WACC:

  • WACC is static: In reality, WACC fluctuates with market conditions, interest rates, and changes in a company's risk profile and capital structure.
  • WACC is solely the average of debt and equity costs: This ignores the crucial weighting and the tax shield benefit of debt.
  • A lower WACC is always better: While a lower WACC suggests lower financing costs, it can also indicate higher risk or a less aggressive growth strategy. The goal is an *optimal* WACC, not necessarily the lowest possible.

WACC Formula and Mathematical Explanation

The calculation for the Weighted Average Cost of Capital (WACC) incorporates the cost of different financing sources, weighted by their proportion in the company's capital structure. The primary components are the cost of equity and the after-tax cost of debt.

The standard formula is:

WACC = (E / V) * Re + (D / V) * Rd * (1 – Tc)

Let's break down each variable:

Variable Meaning Unit Typical Range / Consideration
E Market Value of Equity $ Market Capitalization (Share Price * Shares Outstanding)
D Market Value of Debt $ Total outstanding debt (bonds, loans, etc., at market value if possible, otherwise book value)
V Total Market Value of the Firm $ E + D
Re Cost of Equity % Often estimated using CAPM (Capital Asset Pricing Model), typically 8% – 15% for stable companies.
Rd Cost of Debt (Pre-Tax) % The effective interest rate on the company's debt, typically 3% – 9%.
Tc Corporate Tax Rate % The company's effective marginal tax rate, e.g., 21% in the US.
(1 – Tc) Tax Shield Factor Unitless Reduces the effective cost of debt due to tax deductibility of interest payments.

Step-by-Step Calculation:

  1. Determine the Market Value of Equity (E): Calculate the company's market capitalization.
  2. Determine the Market Value of Debt (D): Sum the market values of all outstanding debt. If market values aren't readily available, book values are often used as a proxy.
  3. Calculate the Total Market Value of the Firm (V): V = E + D.
  4. Calculate the Weight of Equity (E/V): Divide the market value of equity by the total market value.
  5. Calculate the Weight of Debt (D/V): Divide the market value of debt by the total market value.
  6. Determine the Cost of Equity (Re): This is often the most complex part, typically estimated using the Capital Asset Pricing Model (CAPM): Re = Rf + β * (Rm – Rf), where Rf is the risk-free rate, β is the equity beta, and (Rm – Rf) is the market risk premium.
  7. Determine the Pre-Tax Cost of Debt (Rd): This is the current yield on the company's long-term debt.
  8. Determine the Corporate Tax Rate (Tc): Use the company's effective or marginal tax rate.
  9. Calculate the After-Tax Cost of Debt: Rd * (1 – Tc). The interest payments on debt are usually tax-deductible, reducing the effective cost of debt.
  10. Calculate WACC: Plug all the calculated weights and costs into the WACC formula: WACC = (Weight of Equity * Cost of Equity) + (Weight of Debt * After-Tax Cost of Debt).

Practical Examples (Real-World Use Cases)

Understanding the WACC calculation is best done through examples. Let's consider two companies:

Example 1: Tech Startup "Innovate Solutions"

Innovate Solutions is a growing tech company with a significant portion of its funding coming from equity.

  • Market Value of Equity (E): $150,000,000
  • Cost of Equity (Re): 14%
  • Market Value of Debt (D): $50,000,000
  • Interest Rate on Debt (Rd): 7%
  • Corporate Tax Rate (Tc): 25%

Calculations:

  • Total Value (V) = $150M + $50M = $200,000,000
  • Weight of Equity (E/V) = $150M / $200M = 75%
  • Weight of Debt (D/V) = $50M / $200M = 25%
  • After-Tax Cost of Debt = 7% * (1 – 0.25) = 7% * 0.75 = 5.25%
  • WACC = (0.75 * 14%) + (0.25 * 5.25%)
  • WACC = 10.5% + 1.3125%
  • WACC = 11.8125%

Interpretation: Innovate Solutions needs to earn at least 11.81% on its investments to satisfy its investors and lenders. The higher cost of equity significantly drives the WACC.

Example 2: Established Manufacturer "Global Parts Inc."

Global Parts Inc. is a mature company that uses more debt financing.

  • Market Value of Equity (E): $300,000,000
  • Cost of Equity (Re): 10%
  • Market Value of Debt (D): $700,000,000
  • Interest Rate on Debt (Rd): 5%
  • Corporate Tax Rate (Tc): 21%

Calculations:

  • Total Value (V) = $300M + $700M = $1,000,000,000
  • Weight of Equity (E/V) = $300M / $1000M = 30%
  • Weight of Debt (D/V) = $700M / $1000M = 70%
  • After-Tax Cost of Debt = 5% * (1 – 0.21) = 5% * 0.79 = 3.95%
  • WACC = (0.30 * 10%) + (0.70 * 3.95%)
  • WACC = 3.0% + 2.765%
  • WACC = 5.765%

Interpretation: Global Parts Inc. has a lower WACC primarily due to its heavier reliance on cheaper, tax-advantaged debt. It requires a lower rate of return on its assets compared to Innovate Solutions.

How to Use This WACC Calculator

Our WACC calculator simplifies the process of determining your company's cost of capital. Follow these steps for accurate results:

  1. Gather Your Financial Data: You will need the following key figures for your company:
    • Market Value of Equity (Market Capitalization)
    • Cost of Equity (as a percentage)
    • Market Value of Debt
    • Interest Rate on Debt (pre-tax, as a percentage)
    • Corporate Tax Rate (as a percentage)
  2. Input the Values: Enter the gathered figures into the corresponding fields in the calculator. Ensure you use the correct units (dollars for market values, percentages for rates). For percentages, enter the number (e.g., 12 for 12%).
  3. Click "Calculate WACC": Once all inputs are entered, click the calculate button. The calculator will instantly process the data.
  4. Review the Results:
    • Primary Result (WACC %): This is your company's overall weighted average cost of capital, displayed prominently.
    • Intermediate Values: The calculator also shows the Weight of Equity, Weight of Debt, and the After-Tax Cost of Debt. These provide insight into the capital structure and cost components.
    • Table and Chart: A summary table and a visual chart break down the WACC components, making it easier to understand the contribution of each financing source.
  5. Interpret the WACC: Use the calculated WACC as a benchmark. Projects or investments with expected returns higher than the WACC are generally considered financially viable and value-creating for the company. A WACC that is too high may indicate significant financial risk or an inefficient capital structure.
  6. Use the "Reset" Button: If you need to clear the fields and start over, click the "Reset" button.
  7. Use the "Copy Results" Button: Easily copy all calculated results and key inputs for use in reports or further analysis.

Key Factors That Affect WACC Results

Several factors significantly influence a company's Weighted Average Cost of Capital. Understanding these can help businesses manage and potentially lower their financing costs:

  • Capital Structure (Debt-to-Equity Ratio): The mix of debt and equity is the most direct influence. Since debt is typically cheaper than equity and offers a tax shield, a higher proportion of debt (up to a certain point) can lower WACC. However, excessive debt increases financial risk (risk of bankruptcy), which can raise both the cost of debt and the cost of equity, potentially increasing WACC. This is a critical aspect of capital structure optimization.
  • Market Interest Rates: As global or national interest rates rise, the cost of new debt (Rd) increases, directly impacting the WACC. Lenders demand higher returns in a higher interest rate environment.
  • Cost of Equity (Re): This is influenced by the company's risk profile, market volatility (beta), and investor expectations. Higher perceived risk leads to a higher required rate of return from equity investors, thus increasing WACC. Techniques like the Capital Asset Pricing Model (CAPM) are used to estimate this.
  • Corporate Tax Rates: Higher tax rates increase the value of the debt tax shield (1 – Tc), making debt relatively cheaper and potentially lowering WACC. Conversely, lower tax rates reduce this benefit. Tax policies are a significant consideration for financial strategy.
  • Company Risk and Performance: A company's operational efficiency, industry stability, credit rating, and overall financial health directly impact the risk perceived by investors and lenders. Better performance and lower risk generally lead to lower costs for both debt and equity, reducing WACC.
  • Economic Conditions and Inflation: Broader economic factors influence interest rates and investor risk appetite. High inflation often leads to higher interest rates and demands for higher returns on equity, pushing WACC upwards.
  • Cost of Debt (Rd): Beyond general market rates, a company's specific creditworthiness determines its borrowing cost. A strong credit rating allows for lower interest rates on debt, reducing WACC.
  • Growth Prospects: High-growth companies often have higher costs of equity due to higher perceived risk and potential volatility, even if their debt costs are low.

Frequently Asked Questions (FAQ)

What is the difference between WACC and Cost of Equity?

The Cost of Equity (Re) is the return required by shareholders for investing in a company's stock, reflecting the risk associated with equity. WACC, on the other hand, is the blended average cost of *all* capital sources (equity and debt), weighted by their proportion in the company's capital structure. WACC is typically lower than the Cost of Equity because it includes the cheaper, tax-advantaged debt financing.

Why is the cost of debt multiplied by (1 – Tax Rate)?

Interest payments on debt are usually tax-deductible expenses for corporations. This means that the company saves money on taxes equal to the interest paid multiplied by the corporate tax rate. The (1 – Tc) factor effectively calculates the *after-tax* cost of debt, representing the true economic cost to the company.

Should I use market values or book values for equity and debt?

Ideally, you should use market values for both equity (market capitalization) and debt (the current market price of outstanding bonds or loans). Market values reflect the current economic cost and investor expectations. Book values are historical costs and may not accurately represent the current capital structure's economic weight. However, if market values for debt are unavailable, book value is often used as a practical proxy.

How is the Cost of Equity (Re) typically calculated?

The most common method is the Capital Asset Pricing Model (CAPM): Re = Rf + β * (Rm – Rf) Where: Rf = Risk-Free Rate (e.g., yield on long-term government bonds) β = Beta (a measure of the stock's volatility relative to the overall market) Rm = Expected Market Return (Rm – Rf) = Equity Market Risk Premium Other methods include the Dividend Discount Model (DDM).

Can WACC be negative?

Under normal circumstances, WACC cannot be negative. The cost of equity is always positive, and even though the after-tax cost of debt can be low, it is still typically positive. A calculation yielding a negative WACC likely indicates an error in the input data or the calculation itself.

What happens if a company has preferred stock?

If a company has preferred stock, the WACC formula needs to be expanded to include it. The formula becomes: WACC = (E/V * Re) + (D/V * Rd * (1 – Tc)) + (P/V * Rp) Where: P = Market Value of Preferred Stock V = E + D + P (Total capital) Rp = Cost of Preferred Stock (Dividend rate on preferred stock)

How often should WACC be recalculated?

WACC should be recalculated whenever there are significant changes in the company's capital structure, market conditions (interest rates, market risk premium), or the company's risk profile (beta). Annually is a common practice for financial reporting, but interim updates may be necessary following major events like acquisitions, large debt issuances, or significant stock price movements.

What is a "good" WACC?

There is no universal "good" WACC. What constitutes a good WACC is relative to the company's industry, its risk profile, and prevailing market conditions. A "good" WACC is one that is appropriate for the company's specific circumstances and serves as a meaningful hurdle rate for evaluating investment opportunities. Comparing a company's WACC to industry averages and its own historical WACC provides better context.

© 2023 Your Company Name. All rights reserved.

This calculator and information are for educational purposes only. Consult with a qualified financial professional for personalized advice.

var chartInstance = null; function formatNumber(num, decimals = 2) { if (isNaN(num) || num === null) return '–'; return num.toFixed(decimals); } function formatCurrency(num) { if (isNaN(num) || num === null) return '–'; return '$' + num.toLocaleString(undefined, { minimumFractionDigits: 0, maximumFractionDigits: 0 }); } function formatPercentage(num, decimals = 2) { if (isNaN(num) || num === null) return '–.–%'; return (num * 100).toFixed(decimals) + '%'; } function isValidNumber(value) { return !isNaN(parseFloat(value)) && isFinite(value); } function validateInput(id, min = -Infinity, max = Infinity) { var inputElement = document.getElementById(id); var errorElement = document.getElementById(id + 'Error'); var value = inputElement.value.trim(); var parentGroup = inputElement.closest('.input-group'); parentGroup.classList.remove('error'); errorElement.innerText = "; if (value === ") { errorElement.innerText = 'This field cannot be empty.'; parentGroup.classList.add('error'); return false; } var numValue = parseFloat(value); if (isNaN(numValue)) { errorElement.innerText = 'Please enter a valid number.'; parentGroup.classList.add('error'); return false; } if (numValue max) { errorElement.innerText = `Please enter a value between ${min} and ${max}.`; parentGroup.classList.add('error'); return false; } if (id.includes('Value') && numValue < 0) { errorElement.innerText = 'Market value cannot be negative.'; parentGroup.classList.add('error'); return false; } if (id.includes('Cost') || id.includes('Rate')) { if (numValue item.name), datasets: [{ data: dataSeries.map(item => item.value * 100), // Convert to percentage for display backgroundColor: colors, hoverBackgroundColor: colors }] }; chartInstance = new Chart(ctx, { type: 'doughnut', data: chartData, options: { responsive: true, maintainAspectRatio: false, plugins: { legend: { position: 'bottom', }, tooltip: { callbacks: { label: function(tooltipItem) { var label = tooltipItem.label || "; if (label) { label += ': '; } label += formatPercentage(tooltipItem.raw / 100, 2); return label; } } } } } }); } function resetCalculator() { document.getElementById('equityMarketValue').value = '100000000'; document.getElementById('equityCost').value = '12'; document.getElementById('debtMarketValue').value = '50000000'; document.getElementById('debtInterestRate').value = '6'; document.getElementById('corporateTaxRate').value = '21'; // Clear errors var errorElements = document.querySelectorAll('.error-message'); for (var i = 0; i < errorElements.length; i++) { errorElements[i].innerText = ''; } var inputGroups = document.querySelectorAll('.input-group'); for (var i = 0; i < inputGroups.length; i++) { inputGroups[i].classList.remove('error'); } calculateWACC(); // Recalculate with default values } function copyResults() { var primaryResult = document.getElementById('primaryResult').innerText; var weightEquity = document.getElementById('weightEquity').innerText; var weightDebt = document.getElementById('weightDebt').innerText; var afterTaxDebtCost = document.getElementById('afterTaxDebtCost').innerText; var equityValue = document.getElementById('tableEquityValue').innerText; var equityWeight = document.getElementById('tableEquityWeight').innerText; var equityCost = document.getElementById('tableEquityCost').innerText; var equityAfterTaxCost = document.getElementById('tableEquityAfterTaxCost').innerText; var debtValue = document.getElementById('tableDebtValue').innerText; var debtWeight = document.getElementById('tableDebtWeight').innerText; var debtCost = document.getElementById('tableDebtCost').innerText; var debtAfterTaxCost = document.getElementById('tableDebtAfterTaxCost').innerText; var waccTotal = document.getElementById('tableWaccTotal').innerText; var copyText = "— WACC Calculation Results —\n\n"; copyText += "Weighted Average Cost of Capital (WACC): " + primaryResult + "\n\n"; copyText += "Key Components:\n"; copyText += "- Weight of Equity: " + weightEquity + "\n"; copyText += "- Weight of Debt: " + weightDebt + "\n"; copyText += "- After-Tax Cost of Debt: " + afterTaxDebtCost + "\n\n"; copyText += "— Detailed Breakdown —\n"; copyText += "Equity:\n"; copyText += " Market Value: " + equityValue + "\n"; copyText += " Weight: " + equityWeight + "\n"; copyText += " Cost: " + equityCost + "\n"; copyText += " After-Tax Cost: " + equityAfterTaxCost + "\n\n"; copyText += "Debt:\n"; copyText += " Market Value: " + debtValue + "\n"; copyText += " Weight: " + debtWeight + "\n"; copyText += " Cost (Pre-Tax): " + debtCost + "\n"; copyText += " After-Tax Cost: " + debtAfterTaxCost + "\n\n"; copyText += "————————–\n"; copyText += "Total WACC: " + waccTotal + "\n"; navigator.clipboard.writeText(copyText).then(function() { alert('Results copied to clipboard!'); }, function(err) { console.error('Could not copy text: ', err); alert('Failed to copy results. Please copy manually.'); }); } function toggleFaq(element) { var faqItem = element.closest('.faq-item'); faqItem.classList.toggle('active'); } // Initial calculation on load document.addEventListener('DOMContentLoaded', function() { resetCalculator(); // Set defaults and calculate // Add event listeners for input changes to update in real time var inputs = document.querySelectorAll('.loan-calc-container input[type="number"]'); for (var i = 0; i < inputs.length; i++) { inputs[i].addEventListener('input', calculateWACC); } });

Leave a Comment