CONCATENATION+SUBSTITUTE+CHAR(10): keep data in 4 different cells lined up data in 4 other cells

itr674

Well-known Member
Joined
Apr 10, 2002
Messages
1,786
Office Version
  1. 2016
Platform
  1. Windows
First, I don't have capability to put an Excel sample table from this computer.

I have data in range C8:J8.

Number codes are in range C8:F8
Dates are in range G8:J8.

in cell A8 I capture the data in range C8:F8 with this formula

=SUBSTITUTE(
C8&CHAR(10)&
D8&CHAR(10)&
E8&CHAR(10)&
F8,CHAR(10)&CHAR(10),"")

Now I need to capture the dates in cell B8 from range G8:J8, but if a date is missing in rang G9:J8 I would like for the other dates to line up with the numbers captured in cell A8.
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
Depending on your excel version you can use textjoin().
But if blank dates do not correspond to blank numbers you will probably need a helper column. Or many IFs.
 
Upvote 0
but if a date is missing in rang G9:J8 I would like for the other dates to line up with the numbers captured in cell A8.

Hi, this assumes that if there is no data in the cell in the range C8:F8 then the corresponding cell in the range G8:J8 is either also blank or doesn't need to be included in the result.

Replace you formula in A8 with:
=MID(IF(C8="","",CHAR(10)&C8)&IF(D8="","",CHAR(10)&D8)&IF(E8="","",CHAR(10)&E8)&IF(F8="","",CHAR(10)&F8),2,9999)

And in B8 try:
=MID(IF(C8="","",CHAR(10)&G8)&IF(D8="","",CHAR(10)&H8)&IF(E8="","",CHAR(10)&I8)&IF(F8="","",CHAR(10)&J8),2,9999)
 
Upvote 0

Forum statistics

Threads
1,215,059
Messages
6,122,918
Members
449,093
Latest member
dbomb1414

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