Convert 3 rows cell data to one cell data

i have a data in excel which is like below

apple orange banana

I would like to convert this three row data into

apple,orange,banana

how should i do this?

1 Like

apple orange banana is written as 3 rows in the first example

apple
orange
banana

to

apple, orange, banana

@Seonyong written in single cell or 3 cells

three cells

hi @Seonyong,

Check this one will help you.

File :RowData.zip (7.3 KB)

Regards
Balamurugan

HI @Seonyong,

This is another way using the for loop.

File :RowData1.zip (7.6 KB)

Regards
Balamurugan

thank you for example but what i wann do is
convert

apple
banana
orange

to

apple, banana, orange

@Seonyong,

Declare a string variable “Valstr”

you can use like this.

Valstr = String.Join(“,”, arrString)

Ref:

Regards
Balamurugan

thank you so much i feel like it should work but im keep failing…

Can you share the source if possible ?

Regards
Balamurugan

im sorry i cant but i can explain about it
i have data table which is dtMail
and im using assign as

Example = string.join(“,”,dtMail)

but im failing

Hi @Seonyong,

You can try like this,

yourStringName = String.Join(“,”, (From row In dtMail.Rows Select CType(row.Item(“columnname”), String)).ToArray)

Hi @Seonyong

You can use like this.

strValue= string.join(“,”,dtEmial.Rows.Cast(Of DataRow)().Select(Function(a) a.Field(Of String)(“email”).ToArray()))

Regards
Balamurugan

sorry for bothering again but it became like this

System.Char,System.Char,System.Char,System.Char

what should i do from here??

@Seonyong

A bracket is missing.

I have attached the source also.

RowData.zip (2.9 KB)

image

Im sorry to bother u again but actually there is integer inside datatable so there is an error happening as this can only applied to string values. what should i do >?

@Seonyong tell about question clearly or paste screenshot datatable.