An exact formula for computing the average hopcount of the shortest path in finite-size tree-like components of undirected unweighted random networks is proposed. In a tree-like component with size s, there exists virtually only one shortest path between two arbitrary nodes. The summation of hopcounts of all shortest paths can be calculated approximately by the summation of the betweenness of all nodes, and the difference between them is only a constant s (s− 1). Therefore, the average hopcount can be calculated by further dividing the summation by the number of all shortest paths. In this paper, we first derive the conditional probability p (k| s) of the degree distribution of finite components with size s and the summation of all nodal betweenness respectively. By means of these results, we obtain the exact formula for calculating the average hopcount. Also, We confirm the proposed formula by simulations for networks with Poisson and power law degree distributions respectively.