First understand that PE=Price (MPS-Market Price Per Share )/Earning (EPS-Earning Per Share). Now understand that Now P/E of Sensex is nothing but Level of Sensex/EPS. It means that the total Net profit of the company by the number of shares it has, we will get is known as Earning Per Share (EPS).
To arrive at PE for Sensex one need to add the EPS (according to weightage) of all the companies forming part of Sensex and use the following formula i.e.Level of Sensex/EPS to arrive at correct valuation.