Trying to create a cell in which an individuals name is put in proper order and using the IF statement when the individuals name does or does not have a middle initial.

D E F G
1 Mr. Smith John B.

As an example you can see the columns D through G in row 1.

So I inserted a formula in column H1: =IF(G1=" ",D1&" "&F1&" "&E1,D1&" "&F1&" "&G1&"."&" "&E1)

If I have a name that does not have a middle initial (such as B in the example above) then I should not get any middle initial or a period. But I always get a . (period) whether there is a middle initial or not. What am I doing wrong in this formula?