Concatenate if cell in a range is not blank

kshitij_dch

Active Member
Joined
Apr 1, 2012
Messages
362
Office Version
  1. 365
  2. 2016
  3. 2007
Platform
  1. Windows
Hello all,

i am working on a file where i have data from A1 to Z1 ( Country name) and from A2 to Z2 ( Comments)

1st row has country name
2nd row has comments

i am looking to concatenate comments and country name , i am ok to do it with normal concatenate however i have few cells in comments which are blank

i want formula only to concatenate country name and comments where comments are present in cells , if cell is blank formula should skip blanks

i am ok with VBA code if possible
 
With Excel 365, try this.

21 02 19.xlsm
ABCDEFGHIJK
1SingaporeSingapore CommentsVietnamVietnam CommentsHong KongHong Kong CommentsMalaysiaMalaysia CommentsIndiaIndia CommentsConsolidation
2123658To be taken as a complete Value123658Not To be taken as a complete Value123658123658Values are same123658Singapore Comments To be taken as a complete Value Vietnam Comments Not To be taken as a complete Value Malaysia Comments Values are same
3256852568512365825685
4568563568563568563123658568563
5256236256236123658256236
Textjoin
Cell Formulas
RangeFormula
K2K2=TEXTJOIN(CHAR(10)&CHAR(10),1,IF(RIGHT(B1:J1,8)="Comments",IF(B2:J2<>"",B1:J1&CHAR(10)&B2:J2,""),""))
 
Upvote 0

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.

Forum statistics

Threads
1,215,045
Messages
6,122,830
Members
449,096
Latest member
Erald

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