Address format in 1 cell

vivekshanghvi

New Member
Joined
Sep 14, 2006
Messages
36
Office Version
  1. 2007
Platform
  1. Windows
Hi

I have multiple addresses in different cells
Address1 Address2 address3 (11 cells) Cell A1: cell A11

I want help so as to get all these 11 cells combined in 1 cell (in an address format) .. so there will be like 11 lines in a single cell (how you use Alt+enter to move to next line in the same cell)

Please help...
 
Two more questions.
  1. It seems that you have split to a new line where there is a comma in cell E2 but you have not split to a new line where there is a comma in cell D2. What is the logic there?
  2. Why has the value from I2 changed when it appears in cell A5?
1. The problem is due to column width; it automatically moved to the new line but if i will increase the width it will be in a single line
2. I wasnt able to copy the number hence typed a random number
 
Upvote 0

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
With your version of Excel you could use a formula using standard functions as shown in A5 below, or you could employ a user-defined function using the code below and as used in cell A6.
If you need help with how to implement the user-defined function, post back.

VBA Code:
Function Addr(r As Range) As String
  Addr = Replace(Replace(Join(Filter(Split("|" & Join(Application.Index(r.Value, 1, 0), "|@|") & "|", "@"), "||", False), ""), "||", vbLf), "|", "")
End Function

vivekshanghvi.xlsm
ABCDEFGHIJK
1Data recd
21DEEPAK BC/O SHI VILLA2ND FLOOR, FLAT NO 2-ADEB-KUTIR LANE, ULUBARIMUMBAI400056MAHARASHTRA09XXXX91715
3
4Need data in this format
51 DEEPAK B C/O SHI VILLA 2ND FLOOR, FLAT NO 2-A DEB-KUTIR LANE, ULUBARI MUMBAI 400056 MAHARASHTRA 09XXXX91715
61 DEEPAK B C/O SHI VILLA 2ND FLOOR, FLAT NO 2-A DEB-KUTIR LANE, ULUBARI MUMBAI 400056 MAHARASHTRA 09XXXX91715
Sheet1
Cell Formulas
RangeFormula
A5A5=SUBSTITUTE(MID(IF(A2="","","|"&A2)&IF(B2="","","|"&B2)&IF(C2="","","|"&C2)&IF(D2="","","|"&D2)&IF(E2="","","|"&E2)&IF(F2="","","|"&F2)&IF(G2="","","|"&G2)&IF(H2="","","|"&H2)&IF(I2="","","|"&I2)&IF(J2="","","|"&J2)&IF(K2="","","|"&K2),2,500),"|",CHAR(10))
A6A6=Addr(A2:K2)
 
Upvote 0
Solution
With your version of Excel you could use a formula using standard functions as shown in A5 below, or you could employ a user-defined function using the code below and as used in cell A6.
If you need help with how to implement the user-defined function, post back.

VBA Code:
Function Addr(r As Range) As String
  Addr = Replace(Replace(Join(Filter(Split("|" & Join(Application.Index(r.Value, 1, 0), "|@|") & "|", "@"), "||", False), ""), "||", vbLf), "|", "")
End Function

vivekshanghvi.xlsm
ABCDEFGHIJK
1Data recd
21DEEPAK BC/O SHI VILLA2ND FLOOR, FLAT NO 2-ADEB-KUTIR LANE, ULUBARIMUMBAI400056MAHARASHTRA09XXXX91715
3
4Need data in this format
51 DEEPAK B C/O SHI VILLA 2ND FLOOR, FLAT NO 2-A DEB-KUTIR LANE, ULUBARI MUMBAI 400056 MAHARASHTRA 09XXXX91715
61 DEEPAK B C/O SHI VILLA 2ND FLOOR, FLAT NO 2-A DEB-KUTIR LANE, ULUBARI MUMBAI 400056 MAHARASHTRA 09XXXX91715
Sheet1
Cell Formulas
RangeFormula
A5A5=SUBSTITUTE(MID(IF(A2="","","|"&A2)&IF(B2="","","|"&B2)&IF(C2="","","|"&C2)&IF(D2="","","|"&D2)&IF(E2="","","|"&E2)&IF(F2="","","|"&F2)&IF(G2="","","|"&G2)&IF(H2="","","|"&H2)&IF(I2="","","|"&I2)&IF(J2="","","|"&J2)&IF(K2="","","|"&K2),2,500),"|",CHAR(10))
A6A6=Addr(A2:K2)
Great Thanks.. it worked
 
Upvote 0

Forum statistics

Threads
1,224,828
Messages
6,181,217
Members
453,024
Latest member
Wingit77

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top