One of the most popular topics in analyzing complex networks is the detection of its community structure. In this paper, we introduce a new criterion for community detection, called the E‐quality function. The quality of an individual community is defined as a difference between its benefit and its cost, where both are exponential functions of the number of internal edges and the number of external edges, respectively. The obtained optimization problem, maximization of the E‐quality function over all possible partitions of a network, is solved by the variable neighborhood search (VNS)‐based heuristic. Comparison of the new criterion and modularity is performed on the usual test instances from the literature. Experimental results obtained both on artificial and real networks show that the proposed E‐quality function allows detection of the communities existing in the network.