I'm using OS X Mavericks 10.9.4 and had the same problem. OSX would not set up my exchange (office 365) account, even though my iPhone did just fine with the same info (email address and password). It didn't surprise me too much, because of what I learned on this thread: Re: Mac Mail - Not working with my Exchange account?.
Although the OSX "Internet Accounts" pane in "System Preferences" would ask for the same info, it would just crash and report: “There was an error in internet accounts preference pane”, so there was no way to add a new “Exchange” account. I learned online that I could at least create the account by taking the computer offline while setting it up in "Internet Accounts". So, I did that, and got the account created (I used "outlook.office365.com" as the server name). Then I put the computer back online and went into Mail->Preferences->Accounts, and selected the new exchange account on the left to get to the details of the exchange account. Under the "Account Information" tab, all I had to do was to enter my whole email address as the “User Name” - then it started to successfully connect to the exchange server.
Maybe this will help some too.