Getting Data out of cells

ShaneBland

New Member
Joined
Aug 30, 2006
Messages
4
I am not sure how complicated this will be. Here is what I am trying to do.

I have a worksheet with 3 columns each contaning text data. Each row is a seperate "data record". I want to create a macro or function that will take the value of each column in each row and spit out a text snippet with some other information.

Here is an example. Here is one row showing the values from each column.

Gig7/24 710 idsr4ap1-eth0

I want to then take this data and create a text snippet that looks like this below.
"
!
interface Gig7/24
switchport access vlan 710
desc idsr4ap1-eth0
!
"
Anyone have any ideas that can help me out?
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
Assuming your source data is in A1:C1, then try:
=CHAR(34)&CHAR(10)&"!"&CHAR(10)&"interface "&A1&CHAR(10)&"switchport access vlan "&B1&CHAR(10)&"desc "&C1&CHAR(10)&"!"&CHAR(10)&CHAR(34)

You will have to format the cell the the text alignment is wrapped... Format|Cells select the Alignment tab and select Wrap Text.

You may to adjust the column width manually after.


EDIT:

Forgot to add the "desc" part in front of last string.

Formula above is fixed.
 
Upvote 0
Assuming that your data is in A2 thru C2, you might try this...

=CONCATENATE("Interface ",A2&CHAR(10),"Switchport Access vlan ",B2&CHAR(10),"Desc ",C2)

Ensure that the cell where you enter this formula was "Wrap Text" selected.

Hope it helps,
Jim
 
Upvote 0
Is there anyway to put that in some sort of loop to go through all rows and outut that to one cell or text area?
 
Upvote 0
Is there anyway to put that in some sort of loop to go through all rows and outut that to one cell or text area?

Can't you just copy down the formula?
 
Upvote 0
Yeah but I am looking to take the text snippet that is output from that formula from each row and combine it into one text snippit.
 
Upvote 0
Shane

What do you mean by a 'snippit'?

Do you want the result in one cell or multiple cells?

By the way NBVC's formula does return the result in one cell as far as I can see.
 
Upvote 0

Forum statistics

Threads
1,226,216
Messages
6,189,675
Members
453,563
Latest member
Aswathimsanil

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