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
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
what version of office do you have 365 subscription , you could use Textjoin()
 
Upvote 0
i tried =Textjoin(char(10),true,A1:Z2)

it is not skipping blanks
 
Upvote 0
can you post an example of the layout, using XL2BB - see signature or on a share

ConCat - Textjoin.xlsx
ABCDEFGHIJK
1ABCdefgh
212356781011
3
4
5
6
7A B C d e f g h 1 2 3 5 6 7 8 10 11
8
Sheet2
Cell Formulas
RangeFormula
D7D7=TEXTJOIN(CHAR(10),1,A1:K2)
 
Upvote 0
I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)

Is this what you want.
+Fluff 1.xlsm
ABCDEFGHIJ
1ABCDEFGHIJ
2124578910
3
4
5A 1 B 2 D 4 E 5 G 7 H 8 I 9 J 10
Main
Cell Formulas
RangeFormula
A5A5=TEXTJOIN(CHAR(10),1,TRANSPOSE(IF(A2:Z2<>"",A1:Z2,"")))
 
Upvote 0
Thank you Fluff for you reply ,when i used above formula in my workbook, it is showing #Value! (Value used in the formula is of wrong Data Type)
 
Upvote 0
What about Fluff's suggestion...
I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)


.. and etaf's request
can you post an example of the layout, using XL2BB - see signature or on a share

.. otherwise you are just asking helpers to guess what the problem might be. ;)
 
Upvote 0
Book1
ABCDEFGHIJK
1SingapoeCommentsVietnamCommentsHong KongCommentsMalaysiaCommentsIndiaCommentsConsolidation
2123658To be taken as a complete Value123658To be taken as a complete Value123658123658To be taken as a complete Value123658
32568525685256852568525685
4568563568563568563568563568563
5256236256236256236256236256236
Sheet1
 
Upvote 0
Thanks for updating your profile and the XL2BB sample. The sample certainly raises some comments about your original description.
  • There was no mention of merged cells.
  • You said A1:Z1 contained country names but it appears that is only in every second cell.
  • You have numbers listed under each country name & there was no mention of those.
So the question is: What, exactly, would you want returned for that sample data?
Perhaps you could manually enter your desired result in that sheet and post it again with that result included?
 
Upvote 0
Hello Peter , Apologies for not explaining the data in a structured manner , please find below snapshot , Consolidated Comments in Column K that's how i want

Book1
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 complete Value Vietnam Comments Not to be taken as complete Value Malaysia Comments Values are same
3256852568512365825685
4568563568563568563123658568563
5256236256236123658256236
Sheet1
 
Upvote 0

Forum statistics

Threads
1,215,523
Messages
6,125,318
Members
449,218
Latest member
Excel Master

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