This is how to calculate NASDAQ Composite Index:
Market cap of a company listed at NASDAQ = mv[i] =p[i] * s[i]
mv[i] = The market value of the company
p[i] = the last sale price of the company's stock
s[i] = the total outstanding shares of the company
NASDAQ Composite Index (N.C.I) then = sum(i=1..N, mv[i]*bv/ABPMV)
Where N = total number of companies listed at NASDAQ (which currently is 3121).
ABPMV = Adjusted Based Period Market Value
= (MVA2/MVB1)* ABPMV'
MVA2 = market Value after Adjustment
MVA1 = Market Value before Adjustment
ABPMV' = ABPMV before adjustment