Exhibit 23 CONSENT OF INDEPENDENT AUDITORS We consent to the incorporation by reference in this Annual Report (Form 10-K) of United Bankshares, Inc. and Subsidiaries of our report dated February 15, 2002, included in the 2001 Annual Report to Shareholders of United Bankshares, Inc. and Subsidiaries We also consent to the incorporation by reference in the Registration Statements pertaining to the Incentive Stock Option Plan (Form S-8, No. 33-22941) and the Savings and Stock Investment Plan (Form S-8, No. 33-32522) of United Bankshares, Inc. of our report dated February 15, 2002, with respect to the consolidated financial statements of United Bankshares, Inc. and Subsidiaries incorporated by reference in its Annual Report on Form 10-K for the year ended December 31, 2001. /s/ ERNST & YOUNG LLP Charleston, West Virginia March 26, 2002 108