The immediate answer you will no doubt get from your tax advisor is “it depends”, needing of course more information to answer correctly. Assuming the 4-plex is held for the productive use in a trade or business or for investment, the answer is, a 4-Plex should qualify for 1031 exchange, providing you are exchanging it for “like kind” property ( not same kind ). This can be any type of residential, commercial, land, multi-family, etc., investment real estate
So yes you can exchange a house you bought a year or 2 years ago that has seen a 30+% increase in value now for a multifamily or multi tenant office building ( which has not seen that % increase in value yet ), they are both “real” property, used for productive use or for investment.
You should talk with your tax adviser to determine if your property would qualify for a 1031 exchange based on the details of your personal situation.
Also since because of the timing involved in a 1031 exchange you must contact a qualified intermediary and set up an exchange account before the relinquished property ( being sold ) closes, as intermediary must hold the funds, you then must identify and notify the intermediary of the replacement property/properties by midnight of the 45th day after the relinquished property is transferred.
The replacement property must be revived (close) by the exchanger within 180 days from the relinquished property, so it is equality important to talk with a qualified intermediary after talking with your tax adviser before selling the relinquished property or buying replacement property.
You cannot do a 1031 exchange on your personal residence since the primary purpose of the property is for personal use. If you have a multi-family investment property and live in one of the units to manage it, that creates a different set of rules and may qualify for 1031 exchange.
This information is for informational purpose and not intended to be investment or tax advise, and should be explained to you in detail. You should always feel free to consult an attorney and/or tax adviser to obtain further information you deem necessary. I want you to be prepared.