Calculation of Weighted Average Shares Outstanding

Weighted Average Shares Outstanding Calculator :root { –primary-color: #004a99; –success-color: #28a745; –background-color: #f8f9fa; –text-color: #333; –light-gray: #e9ecef; –dark-gray: #6c757d; –white: #fff; –border-radius: 8px; –box-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); margin: 0; padding: 20px; line-height: 1.6; } .container { max-width: 960px; margin: 0 auto; background-color: var(–white); padding: 30px; border-radius: var(–border-radius); box-shadow: var(–box-shadow); } h1, h2, h3 { color: var(–primary-color); text-align: center; margin-bottom: 20px; } h1 { font-size: 2.5em; } h2 { font-size: 1.8em; border-bottom: 2px solid var(–primary-color); padding-bottom: 10px; margin-top: 40px; } h3 { font-size: 1.4em; margin-top: 30px; } .calculator-section { background-color: var(–white); padding: 30px; border-radius: var(–border-radius); box-shadow: var(–box-shadow); margin-bottom: 40px; } .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(–dark-gray); } .input-group input[type="number"], .input-group select { padding: 12px 15px; border: 1px solid var(–light-gray); border-radius: var(–border-radius); font-size: 1em; box-sizing: border-box; transition: border-color 0.3s ease; } .input-group input[type="number"]: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: var(–dark-gray); margin-top: 5px; } .error-message { color: red; font-size: 0.8em; margin-top: 5px; display: none; /* Hidden by default */ } .button-group { display: flex; gap: 15px; margin-top: 25px; justify-content: center; flex-wrap: wrap; } .btn { padding: 12px 25px; border: none; border-radius: var(–border-radius); font-size: 1em; font-weight: bold; cursor: pointer; transition: background-color 0.3s ease, transform 0.2s ease; text-transform: uppercase; letter-spacing: 0.5px; } .btn-primary { background-color: var(–primary-color); color: var(–white); } .btn-primary:hover { background-color: #003b7a; transform: translateY(-2px); } .btn-secondary { background-color: var(–dark-gray); color: var(–white); } .btn-secondary:hover { background-color: #5a6268; transform: translateY(-2px); } .btn-copy { background-color: var(–success-color); color: var(–white); } .btn-copy:hover { background-color: #218838; transform: translateY(-2px); } .results-section { background-color: var(–primary-color); color: var(–white); padding: 25px; border-radius: var(–border-radius); margin-top: 30px; text-align: center; box-shadow: 0 6px 15px rgba(0, 74, 153, 0.3); } .results-section h3 { color: var(–white); margin-bottom: 15px; border-bottom: none; } .main-result { font-size: 2.5em; font-weight: bold; margin: 10px 0; display: block; } .main-result-label { font-size: 1.1em; opacity: 0.9; } .intermediate-results { display: flex; flex-wrap: wrap; justify-content: center; gap: 20px; margin-top: 20px; padding-top: 15px; border-top: 1px solid rgba(255, 255, 255, 0.3); } .intermediate-result-item { text-align: center; } .intermediate-result-item span { font-size: 1.8em; font-weight: bold; display: block; } .intermediate-result-item p { font-size: 0.95em; margin: 5px 0 0; opacity: 0.9; } .formula-explanation { font-size: 0.9em; color: var(–dark-gray); margin-top: 15px; text-align: center; padding: 10px; background-color: var(–light-gray); border-radius: var(–border-radius); } .chart-container, .table-container { margin-top: 40px; padding: 25px; background-color: var(–white); border-radius: var(–border-radius); box-shadow: var(–box-shadow); } .chart-container { text-align: center; } canvas { max-width: 100%; height: auto; } .chart-caption { font-size: 0.9em; color: var(–dark-gray); margin-top: 10px; text-align: center; } table { width: 100%; border-collapse: collapse; margin-top: 15px; } th, td { padding: 12px 15px; text-align: right; border-bottom: 1px solid var(–light-gray); } th { background-color: var(–primary-color); color: var(–white); font-weight: bold; text-align: right; } thead th { background-color: var(–light-gray); color: var(–text-color); } td:first-child, th:first-child { text-align: left; } .table-caption { font-size: 0.9em; color: var(–dark-gray); margin-bottom: 10px; text-align: center; } .article-content { margin-top: 40px; background-color: var(–white); padding: 30px; border-radius: var(–border-radius); box-shadow: var(–box-shadow); } .article-content h2 { text-align: left; margin-top: 0; border-bottom: 2px solid var(–primary-color); } .article-content h3 { text-align: left; margin-top: 25px; } .article-content p { margin-bottom: 15px; } .article-content ul, .article-content ol { margin-left: 20px; margin-bottom: 15px; } .article-content li { margin-bottom: 8px; } .faq-item { border-left: 4px solid var(–primary-color); padding-left: 15px; margin-bottom: 20px; } .faq-item strong { display: block; font-size: 1.1em; color: var(–primary-color); margin-bottom: 5px; } .internal-links-section { margin-top: 30px; padding: 25px; background-color: var(–light-gray); border-radius: var(–border-radius); } .internal-links-section h3 { text-align: left; margin-top: 0; border-bottom: none; } .internal-links-section ul { list-style: none; padding: 0; } .internal-links-section li { margin-bottom: 10px; } .internal-links-section a { color: var(–primary-color); text-decoration: none; font-weight: bold; } .internal-links-section a:hover { text-decoration: underline; } .internal-links-section span { font-size: 0.9em; color: var(–dark-gray); display: block; margin-top: 3px; } footer { text-align: center; margin-top: 40px; padding: 20px; font-size: 0.9em; color: var(–dark-gray); } @media (min-width: 768px) { .loan-calc-container { flex-direction: column; } .input-group input, .input-group select { width: 100%; } .button-group { justify-content: flex-start; } }

Weighted Average Shares Outstanding Calculator

Accurately calculate your company's Weighted Average Shares Outstanding (WASO) to provide a true reflection of earnings per share and overall valuation.

WASO Calculator

Enter the number of shares issued at the beginning of the reporting period.
Number of new shares issued after the period start date.
Enter the number of days from the period start until the new shares were issued (e.g., 180 for mid-year).
Number of shares bought back by the company after the period start date.
Enter the number of days from the period start until shares were repurchased.
Typically 365 for an annual period or 90 for a quarterly period.

Calculation Results

0 Weighted Average Shares Outstanding (WASO)
0

Weighted Initial Shares

0

Weighted Issued Shares

0

Weighted Repurchased Shares

Formula: WASO = Initial Shares + (Shares Issued * Days Issued / Period Days) – (Shares Repurchased * Days Repurchased / Period Days)
Summary of Share Transactions
Transaction Type Shares Days Outstanding Factor Weighted Impact
Shares at Period Start 0 0.00 0
Shares Issued 0 0.00 0
Shares Repurchased 0 0.00 0
Total Weighted Average Shares Outstanding (WASO) 0
Share Transaction Breakdown

What is Weighted Average Shares Outstanding (WASO)?

Weighted Average Shares Outstanding (WASO) is a crucial financial metric used to calculate a company's earnings per share (EPS). Unlike a simple average, WASO accounts for the timing of when new shares were issued or repurchased throughout a reporting period (like a quarter or a year). This provides a more accurate picture of the average number of shares that were outstanding and, therefore, entitled to earnings during that period.

Who Should Use It?

WASO is primarily used by:

  • Publicly traded companies: For accurate EPS reporting to shareholders and regulatory bodies.
  • Investors and Analysts: To evaluate a company's profitability on a per-share basis, compare performance across different periods, and perform valuation analysis.
  • Financial Institutions: For assessing creditworthiness and investment potential.
  • Management: To understand the impact of share issuance and buyback programs on shareholder value.

Common Misconceptions

A common misconception is that WASO is simply the average of the shares outstanding at the beginning and end of the period. This is incorrect because it doesn't consider any share transactions that occurred in between. Another mistake is overlooking the impact of the *timing* of these transactions – issuing shares on the last day of the quarter has a much smaller impact than issuing them on the first day.

Weighted Average Shares Outstanding (WASO) Formula and Mathematical Explanation

The calculation of Weighted Average Shares Outstanding (WASO) involves adjusting the number of shares outstanding by the proportion of the reporting period they were outstanding. This ensures that all share issuances and repurchases are weighted appropriately by their duration.

The Core Formula

The most common formula for calculating WASO, particularly for a single reporting period (e.g., a quarter or a year), is as follows:

WASO = S + (SI × T1 / T) – (SR × T2 / T)

Variable Explanations

  • WASO: Weighted Average Shares Outstanding. This is the final number we aim to calculate, representing the average number of shares outstanding over the period, weighted by time.
  • S: Shares Outstanding at the Beginning of the Period. This is the total number of shares held by all shareholders at the very start of the reporting period.
  • SI: Number of Shares Issued During the Period. This is the count of any new shares that the company created and sold to the public or investors after the period began.
  • SR: Number of Shares Repurchased (Treasury Stock) During the Period. This is the count of shares the company bought back from the open market after the period began.
  • T1: Number of Days (or fraction of the period) that the Newly Issued Shares (SI) were Outstanding. This is the time elapsed from the issuance date until the end of the reporting period.
  • T2: Number of Days (or fraction of the period) that the Repurchased Shares (SR) were NOT Outstanding. This is the time elapsed from the repurchase date until the end of the reporting period.
  • T: Total Number of Days in the Reporting Period. This is the full duration of the accounting period (e.g., 90 days for a quarter, 365 days for a year).

Derivation Steps

  1. Start with the baseline: Begin with the number of shares outstanding at the start of the period (S). These shares were outstanding for the entire duration (T days).
  2. Account for issued shares: For shares issued during the period (SI), only a fraction of the period applies. Multiply SI by the fraction of the period they were outstanding (T1/T). Add this weighted amount to the initial shares.
  3. Account for repurchased shares: For shares repurchased during the period (SR), these shares were no longer outstanding for a portion of the period. Multiply SR by the fraction of the period they were *not* outstanding (T2/T). Subtract this weighted amount from the running total.
  4. Final WASO: The resulting figure is the Weighted Average Shares Outstanding (WASO).

Variables Table

Variable Meaning Unit Typical Range
WASO Weighted Average Shares Outstanding Shares Positive value (typically millions)
S Shares Outstanding at Period Start Shares Positive value (typically millions)
SI Shares Issued During Period Shares Non-negative (typically thousands to millions)
SR Shares Repurchased During Period Shares Non-negative (typically thousands to millions)
T1 Days Issued Shares Were Outstanding Days 0 to T
T2 Days Repurchased Shares Were Not Outstanding Days 0 to T
T Total Days in Period Days 90 (Quarterly), 365 (Annually)

Practical Examples (Real-World Use Cases)

Example 1: Quarterly Calculation with Issuance

Scenario: A tech company, "Innovate Solutions Inc.," is reporting for Q3 (90 days). They started the quarter with 10,000,000 shares. On day 45, they issued 1,000,000 new shares to fund an acquisition. They repurchased no shares.

  • Shares at Period Start (S): 10,000,000
  • Shares Issued (SI): 1,000,000
  • Days Issued Shares Were Outstanding (T1): 90 – 45 = 45 days
  • Shares Repurchased (SR): 0
  • Days Repurchased Shares Were Not Outstanding (T2): 0
  • Total Days in Period (T): 90

Calculation:

WASO = 10,000,000 + (1,000,000 × 45 / 90) – (0 × 0 / 90)

WASO = 10,000,000 + (1,000,000 × 0.5) – 0

WASO = 10,000,000 + 500,000

WASO = 10,500,000 shares

Financial Interpretation: The WASO of 10,500,000 reflects that, on average, the company had slightly more shares outstanding than at the start, due to the mid-quarter issuance. This higher average will slightly decrease the EPS compared to if the shares hadn't been issued yet.

Example 2: Annual Calculation with Issuance and Repurchase

Scenario: "Global Manufacturing Corp." is reporting for the fiscal year (365 days). They began the year with 50,000,000 shares. On March 1st (day 60), they issued 5,000,000 shares for a strategic partnership. On October 1st (day 274), they repurchased 2,000,000 shares as part of a share buyback program.

  • Shares at Period Start (S): 50,000,000
  • Shares Issued (SI): 5,000,000
  • Days Issued Shares Were Outstanding (T1): 365 – 60 = 305 days
  • Shares Repurchased (SR): 2,000,000
  • Days Repurchased Shares Were Not Outstanding (T2): 365 – 274 = 91 days
  • Total Days in Period (T): 365

Calculation:

WASO = 50,000,000 + (5,000,000 × 305 / 365) – (2,000,000 × 91 / 365)

WASO = 50,000,000 + (5,000,000 × 0.8356) – (2,000,000 × 0.2493)

WASO = 50,000,000 + 4,178,082 – 498,630

WASO = 53,679,452 shares

Financial Interpretation: The WASO of approximately 53.7 million shares is higher than the starting amount. This is because the significant number of shares issued for a large portion of the year had a greater impact than the shares repurchased later in the year. This higher WASO will lower the EPS reported for the year.

How to Use This Weighted Average Shares Outstanding Calculator

Our WASO calculator is designed for simplicity and accuracy. Follow these steps to get your results:

  1. Enter Initial Shares: Input the total number of shares your company had outstanding at the very beginning of the reporting period (e.g., January 1st for an annual report, April 1st for Q2).
  2. Enter Shares Issued: If your company issued new shares during the period (e.g., through stock options, secondary offerings), enter the total number of these new shares.
  3. Specify Issuance Timing: In the "Date Shares Were Issued" field, enter the number of days from the *start* of the period until the new shares were issued. For example, if the period is 365 days and shares were issued on March 1st, that's roughly 60 days from the start.
  4. Enter Shares Repurchased: If your company bought back its own shares (a share repurchase or treasury stock transaction), enter the total number of shares repurchased.
  5. Specify Repurchase Timing: In the "Date Shares Were Repurchased" field, enter the number of days from the *start* of the period until the repurchase occurred.
  6. Enter Total Period Days: Confirm the total number of days in your reporting period (typically 365 for a year, 90 for a quarter, 31 for January, etc.).
  7. Calculate: Click the "Calculate WASO" button.

How to Read Results

  • Weighted Average Shares Outstanding (WASO): This is your primary result, prominently displayed. It represents the adjusted average number of shares over the period.
  • Weighted Initial Shares: Shows the contribution of the starting shares (which were outstanding for the full period).
  • Weighted Issued Shares: Shows the time-weighted contribution of newly issued shares.
  • Weighted Repurchased Shares: Shows the time-weighted reduction from share repurchases.
  • Summary Table: Provides a detailed breakdown of each component's contribution to the final WASO.
  • Chart: Visually represents the impact of each transaction type on the average share count.

Decision-Making Guidance

Understanding your WASO helps in several ways:

  • EPS Analysis: A higher WASO generally leads to lower EPS, assuming net income remains constant. Monitor WASO changes to explain fluctuations in EPS.
  • Impact of Dilution/Anti-dilution: Track WASO to manage potential dilution from stock options or convertible securities, and to assess the effectiveness of share repurchase programs in reducing share count.
  • Forecasting: Use WASO trends to forecast future EPS and valuation metrics for investors.

Key Factors That Affect Weighted Average Shares Outstanding Results

Several factors can significantly influence the calculation and the resulting WASO figure:

  1. Timing of Share Issuances: Shares issued earlier in the period have a larger weighting (higher T1/T ratio) and thus increase WASO more substantially than those issued late in the period. This directly impacts the weighted average calculation.
  2. Timing of Share Repurchases: Conversely, shares repurchased earlier in the period reduce the average number of outstanding shares more significantly (higher T2/T ratio) than late repurchases. This effectively lowers WASO.
  3. Magnitude of Share Transactions: The sheer number of shares issued or repurchased is a primary driver. A large issuance will increase WASO considerably, while a large buyback will decrease it.
  4. Stock Splits and Stock Dividends: These events require retrospective restatement. The WASO for all periods presented must be adjusted as if the split or dividend had occurred at the beginning of the earliest period presented. Our calculator assumes no splits/dividends within the input period but handles the weighted average logic correctly.
  5. Contingent Issuances: Shares issued upon the fulfillment of certain conditions (e.g., performance targets) are only included in WASO if the conditions were met within the reporting period. If they are issued *after* the period, they affect future WASO calculations.
  6. Convertible Securities (Complex Cases): For diluted EPS calculations (a related but distinct metric), convertible bonds and preferred stock are considered. Their potential impact is assessed using a "if-converted" method, affecting the share count calculation under specific conditions, though not directly altering the basic WASO figure itself.
  7. Class of Shares: If a company has multiple classes of common stock with different voting rights or dividend entitlements, each class may need a separate weighted average calculation, and then they are summed. This calculator assumes a single class for simplicity.
  8. Period Length: The denominator (T) is crucial. Using days provides the most accuracy. If a simplified fraction of the period is used (e.g., 0.5 for mid-year), the accuracy decreases slightly. Ensure consistency in days measurement.

Frequently Asked Questions (FAQ)

Q1: What is the difference between basic and diluted EPS?

Basic EPS uses the simple Weighted Average Shares Outstanding (WASO). Diluted EPS considers the potential impact of all dilutive securities (like stock options, warrants, convertible bonds) and calculates a hypothetical WASO that would result if these securities were exercised or converted. Our calculator focuses on the basic WASO.

Q2: Do stock splits affect WASO?

Yes, stock splits and stock dividends require retrospective adjustment. The WASO for all prior periods presented must be restated to reflect the split as if it happened at the beginning of the earliest period. For example, a 2-for-1 split doubles the WASO for all presented periods.

Q3: When should I use a 365-day or 90-day period?

Use 365 days for annual reports. Use 90 days for quarterly reports (assuming a standard 30-day quarter). For specific months, use the actual number of days in that month (e.g., 31 for January, 28/29 for February).

Q4: How do stock options impact WASO?

For basic WASO, options only count if they are exercised and new shares are issued. For diluted EPS, options are considered using methods like the Treasury Stock Method, which estimates how many shares would be issued if the option proceeds were used to buy back stock.

Q5: What if shares were issued/repurchased on multiple dates?

For more complex scenarios with multiple issuances or repurchases, you would calculate the weighted impact of each transaction separately and then sum them up. For example, calculate the weighted effect of shares issued on date A, add the weighted effect of shares issued on date B, and then subtract the weighted effect of shares repurchased on date C.

Q6: Is WASO the same as the number of shares outstanding at year-end?

No. WASO is an average weighted by time. Year-end shares outstanding is just a snapshot at a single point in time. WASO provides a more representative average for calculating per-share metrics over the entire period.

Q7: Can WASO be a fraction?

Technically, WASO represents a number of shares and should be a whole number. However, intermediate calculations might result in fractions. It's standard practice to round the final WASO figure to the nearest whole share, or sometimes to a few decimal places for high precision in analysis.

Q8: Does the calculator handle different fiscal year ends?

Yes, as long as you correctly input the total number of days in the reporting period (T) and the number of days from the start date for issuances/repurchases (T1, T2), the calculator will work for any fiscal year or quarter, regardless of its start and end dates.

© 2023 Your Financial Tools. All rights reserved.

var initialSharesInput = document.getElementById('initialShares'); var sharesIssuedInput = document.getElementById('sharesIssued'); var sharesIssuedDateInput = document.getElementById('sharesIssuedDate'); var sharesRepurchasedInput = document.getElementById('sharesRepurchased'); var sharesRepurchasedDateInput = document.getElementById('sharesRepurchasedDate'); var periodDaysInput = document.getElementById('periodDays'); var initialSharesError = document.getElementById('initialSharesError'); var sharesIssuedError = document.getElementById('sharesIssuedError'); var sharesIssuedDateError = document.getElementById('sharesIssuedDateError'); var sharesRepurchasedError = document.getElementById('sharesRepurchasedError'); var sharesRepurchasedDateError = document.getElementById('sharesRepurchasedDateError'); var periodDaysError = document.getElementById('periodDaysError'); var resultsSection = document.getElementById('resultsSection'); var weightedAverageSharesSpan = document.getElementById('weightedAverageShares'); var weightedInitialSharesSpan = document.getElementById('weightedInitialShares'); var weightedIssuedSharesSpan = document.getElementById('weightedIssuedShares'); var weightedRepurchasedSharesSpan = document.getElementById('weightedRepurchasedShares'); var tableInitialSharesTd = document.getElementById('tableInitialShares'); var tableIssuedSharesTd = document.getElementById('tableIssuedShares'); var tableRepurchasedSharesTd = document.getElementById('tableRepurchasedShares'); var tableTotalWASOTd = document.getElementById('tableTotalWASO'); var tableFactorInitialTd = document.getElementById('tableFactorInitial'); var tableFactorIssuedTd = document.getElementById('tableFactorIssued'); var tableFactorRepurchasedTd = document.getElementById('tableFactorRepurchased'); var tableWeightedInitialTd = document.getElementById('tableWeightedInitial'); var tableWeightedIssuedTd = document.getElementById('tableWeightedIssued'); var tableWeightedRepurchasedTd = document.getElementById('tableWeightedRepurchased'); var wasoChart; var chartInstance = null; function formatNumber(num, decimals = 0) { if (isNaN(num) || num === null) return '0'; return parseFloat(num).toLocaleString(undefined, { minimumFractionDigits: decimals, maximumFractionDigits: decimals }); } function formatShares(num) { if (isNaN(num) || num === null) return '0'; return parseFloat(num).toLocaleString(undefined, { minimumFractionDigits: 0, maximumFractionDigits: 0 }); } function validateInput(inputElement, errorElement, minValue = null, maxValue = null) { var value = parseFloat(inputElement.value); var errorDiv = document.getElementById(errorElement); errorDiv.style.display = 'none'; inputElement.style.borderColor = '#ced4da'; if (inputElement.value.trim() === ") { errorDiv.textContent = 'This field cannot be empty.'; errorDiv.style.display = 'block'; inputElement.style.borderColor = 'red'; return false; } if (isNaN(value)) { errorDiv.textContent = 'Please enter a valid number.'; errorDiv.style.display = 'block'; inputElement.style.borderColor = 'red'; return false; } if (minValue !== null && value maxValue) { errorDiv.textContent = 'Value cannot be greater than ' + maxValue + '.'; errorDiv.style.display = 'block'; inputElement.style.borderColor = 'red'; return false; } return true; } function calculateWASO() { // Clear previous errors initialSharesError.style.display = 'none'; sharesIssuedError.style.display = 'none'; sharesIssuedDateError.style.display = 'none'; sharesRepurchasedError.style.display = 'none'; sharesRepurchasedDateError.style.display = 'none'; periodDaysError.style.display = 'none'; // Validate inputs var isValid = true; isValid = validateInput(initialSharesInput, 'initialSharesError', 0) && isValid; isValid = validateInput(sharesIssuedInput, 'sharesIssuedError', 0) && isValid; isValid = validateInput(sharesIssuedDateInput, 'sharesIssuedDateError', 0, parseFloat(periodDaysInput.value)) && isValid; isValid = validateInput(sharesRepurchasedInput, 'sharesRepurchasedError', 0) && isValid; isValid = validateInput(sharesRepurchasedDateInput, 'sharesRepurchasedDateError', 0, parseFloat(periodDaysInput.value)) && isValid; isValid = validateInput(periodDaysInput, 'periodDaysError', 1) && isValid; if (!isValid) { resultsSection.style.display = 'none'; return; } var initialShares = parseFloat(initialSharesInput.value); var sharesIssued = parseFloat(sharesIssuedInput.value); var sharesIssuedDate = parseFloat(sharesIssuedDateInput.value); var sharesRepurchased = parseFloat(sharesRepurchasedInput.value); var sharesRepurchasedDate = parseFloat(sharesRepurchasedDate.value); var periodDays = parseFloat(periodDaysInput.value); var weightedInitialShares = initialShares; // Outstanding for the whole period var weightedIssuedShares = (sharesIssued * (periodDays – sharesIssuedDate)) / periodDays; var weightedRepurchasedShares = (sharesRepurchased * (periodDays – sharesRepurchasedDate)) / periodDays; var weightedAverageShares = weightedInitialShares + weightedIssuedShares – weightedRepurchasedShares; // Ensure WASO is not negative (can happen with extreme repurchase scenarios, though unlikely in basic calc) if (weightedAverageShares 0 ? ((periodDays – sharesIssuedDate) / periodDays).toFixed(2) : '0.00'; tableFactorRepurchasedTd.textContent = (periodDays – sharesRepurchasedDate) / periodDays > 0 ? ((periodDays – sharesRepurchasedDate) / periodDays).toFixed(2) : '0.00'; tableWeightedInitialTd.textContent = formatShares(weightedInitialShares); tableWeightedIssuedTd.textContent = formatShares(weightedIssuedShares); tableWeightedRepurchasedTd.textContent = formatShares(weightedRepurchasedShares); updateChart(initialShares, weightedIssuedShares, weightedRepurchasedShares); } function resetCalculator() { initialSharesInput.value = '1000000'; sharesIssuedInput.value = '200000'; sharesIssuedDateInput.value = '180'; sharesRepurchasedInput.value = '50000'; sharesRepurchasedDateInput.value = '270'; periodDaysInput.value = '365'; // Clear errors initialSharesError.textContent = "; initialSharesError.style.display = 'none'; sharesIssuedError.textContent = "; sharesIssuedError.style.display = 'none'; sharesIssuedDateError.textContent = "; sharesIssuedDateError.style.display = 'none'; sharesRepurchasedError.textContent = "; sharesRepurchasedError.style.display = 'none'; sharesRepurchasedDateError.textContent = "; sharesRepurchasedDateError.style.display = 'none'; periodDaysError.textContent = "; periodDaysError.style.display = 'none'; // Reset styles initialSharesInput.style.borderColor = '#ced4da'; sharesIssuedInput.style.borderColor = '#ced4da'; sharesIssuedDateInput.style.borderColor = '#ced4da'; sharesRepurchasedInput.style.borderColor = '#ced4da'; sharesRepurchasedDateInput.style.borderColor = '#ced4da'; periodDaysInput.style.borderColor = '#ced4da'; resultsSection.style.display = 'none'; } function copyResults() { var mainResult = weightedAverageSharesSpan.textContent; var intermediate1 = weightedInitialSharesSpan.textContent; var intermediate2 = weightedIssuedSharesSpan.textContent; var intermediate3 = weightedRepurchasedSharesSpan.textContent; var assumption1 = "Initial Shares: " + formatShares(parseFloat(initialSharesInput.value)); var assumption2 = "Shares Issued: " + formatShares(parseFloat(sharesIssuedInput.value)) + " on day " + sharesIssuedDateInput.value; var assumption3 = "Shares Repurchased: " + formatShares(parseFloat(sharesRepurchasedInput.value)) + " on day " + sharesRepurchasedDateInput.value; var assumption4 = "Period Days: " + periodDaysInput.value; var textToCopy = "Weighted Average Shares Outstanding (WASO):\n\n" + mainResult + "\n\n" + "Key Components:\n" + "- Weighted Initial Shares: " + intermediate1 + "\n" + "- Weighted Issued Shares: " + intermediate2 + "\n" + "- Weighted Repurchased Shares: " + intermediate3 + "\n\n" + "Assumptions:\n" + assumption1 + "\n" + assumption2 + "\n" + assumption3 + "\n" + assumption4 + "\n\n" + "Formula: WASO = Initial Shares + (Shares Issued * Days Issued / Period Days) – (Shares Repurchased * Days Repurchased / Period Days)"; navigator.clipboard.writeText(textToCopy).then(function() { // Optionally provide user feedback, e.g., a temporary message var copyButton = document.querySelector('.btn-copy'); var originalText = copyButton.textContent; copyButton.textContent = 'Copied!'; setTimeout(function() { copyButton.textContent = originalText; }, 2000); }).catch(function(err) { console.error('Failed to copy text: ', err); // Fallback for browsers without clipboard API alert('Copy failed. Please manually copy the results.'); }); } function updateChart(initial, issued, repurchased) { var ctx = document.getElementById('wasoChart').getContext('2d'); // Destroy previous chart instance if it exists if (chartInstance) { chartInstance.destroy(); } var labels = ['Initial Shares', 'Issued Shares (Weighted)', 'Repurchased Shares (Weighted)']; var data = [initial, issued, repurchased]; // Note: repurchased is a negative contribution to WASO, but plotted as positive magnitude here for breakdown clarity. chartInstance = new Chart(ctx, { type: 'bar', data: { labels: labels, datasets: [{ label: 'Share Contribution', data: data, backgroundColor: [ 'rgba(0, 74, 153, 0.6)', // Primary color for initial 'rgba(40, 167, 69, 0.6)', // Success color for issued 'rgba(220, 53, 69, 0.6)' // Danger color for repurchased ], borderColor: [ 'rgba(0, 74, 153, 1)', 'rgba(40, 167, 69, 1)', 'rgba(220, 53, 69, 1)' ], borderWidth: 1 }] }, options: { responsive: true, maintainAspectRatio: false, scales: { y: { beginAtZero: true, title: { display: true, text: 'Number of Shares' }, ticks: { callback: function(value) { return value.toLocaleString(); } } } }, plugins: { legend: { display: false // Hiding legend as labels are clear }, title: { display: true, text: 'Contribution to Weighted Average Shares Outstanding' } } } }); } // Initial calculation on load document.addEventListener('DOMContentLoaded', function() { // Dynamically load Chart.js library if not present // This is a common practice for standalone HTML files if Chart.js isn't bundled if (typeof Chart === 'undefined') { var script = document.createElement('script'); script.src = 'https://cdn.jsdelivr.net/npm/chart.js@3.7.0/dist/chart.min.js'; script.onload = function() { calculateWASO(); // Calculate after chart library is loaded }; script.onerror = function() { console.error("Failed to load Chart.js library."); // Optionally display a message to the user }; document.head.appendChild(script); } else { calculateWASO(); // Calculate immediately if Chart.js is already available } });

Leave a Comment