If you have a Mac, I would recommend Scrivener for writing and Vellum for formatting.
Scrivener is cheap and has many useful functions such as storyboarding and split screen (which makes it easy to read your research on one side and type your book on the other). You can use it to compile your ready book into epub, mobi, pdf or word file.
Vellum is really easy to use - you copypaste your word file there and can tweak the appearance of your text right there on the screen and then download the epub and mobi files to your computer.
If you prefer to work with a word file, you could download the free formatting book from Smashwords. I used it to format my first book (Nephilim Quest 1: Shadowhunter) and it took me a few days. (Would have taken a shorter time but I only had a few hours in the evenings to do the formatting). The link is here: https://www.smashwords.com/books/view/52
For my second book (Nephilim Quest 2: Moon Daughter) I used Vellum and the book was formatted in half an hour. I am planning on re-formatting my first book with it now that I need to add pictures of my other book covers at the end. (Yes, you can do this with Vellum).