wouldn't it help to have some context? i would think either could be correct depending on how you were using the phrase...just my two cents
In doing so I racked up a profit of 400 dollars. In so doing I racked up a profit of 400 dollars. In doing so sounds correct.
I racked up a profit of 400 dollars 'in doing so.' I racked up a profit of 400 dollars 'in so doing.' To end the statement 'in so doing' sounds more appropriate, but they are both valid.
the use of in so doing or in doing so is very very bad English. the right thing to say is therefore or hence.
We need a english grammar language pro with sources. (sidenote: are there official rules to how grammar of different languages work ? or do we just bow to what the pros say?(the second seems very flawed)) (further expanding on this side note: what about how the language changes? do the rules change to match or do the experts just say what they should be(or the common accepted rules?)) (is there some sort of council that meets and determines the (new) laws? ~so many questions ~ (If there are ironclad rules I wonder how many rules I just broke, haha)