In Outlook 2003 and 2007, click File > Import and Export, select "Export to a file," click Next, choose either comma-separated value option, and click Next again. Browse to and select your Contacts folder, click Next again, choose the Browse button, pick a location for the file, give it a name with the .csv extension, click OK, and click Next once more. Verify the action and click Finish.
After the file-export finishes (it can take a while), open Gmail, click Contacts on the left, and choose Import at the top right. Click Browse and navigate to and select the file you just exported. You can create a new group for the contacts by choosing "Also add these imported contacts to" before you click Import. You'll be prompted to give the group a name.
Once the file is imported, you'll see a summary indicating the number of contacts added, merged, or ignored because they were duplicates. Click OK to return to your list of contacts.
Now turn the process around by moving your Gmail contacts to Outlook. On the Gmail Contacts page, click Export in the top right, choose to export just your contacts or your contacts and Gmail's suggested contacts, select "Outlook's CSV format (for importing into Outlook or other applications)," and click the Export button.
The file is named "contacts.csv" automatically. Select the Save File button (it's chosen by default) and click OK. The list will be saved in your Downloads folder (or whichever folder you've picked as your default). Open Outlook, click File > Import and Export > Import from another program or file > Next.
Choose the appropriate comma-separated-value option and click Next again. Click the Browse button, navigate to and select the .csv file you just created, pick one of the options regarding duplicate entries (the default is "Allow duplicates to be created"), and click Next again. Choose the destination folder (probably Contacts under Personal Folders for your account), verify the action, and click Finish.
Any addresses with unrecognizable names will be listed first with only the e-mail address, but other contacts will appear alphabetically by last name.