KinsDotNet
KinsDotNet

Reputation: 1560

How can I output the value of two cells beside each other in excel?

I have two columns, old_name and new_name.

I am trying to put together a command to be used elsewhere based on these two columns. So I want to output this into another cell, perhaps C2:

replace [contents of old_name] [contents of new_name]

How can I accomplish this task?

I don't seem to be able to simply type:

replace =A2 =B2

nor

replace =CELL("contents", A2) =CELL("contents", B2)


--------------------------------------------------
|         A                 |         B          |
--------------------------------------------------
| 1 |    old_name           |         new_name   |
--------------------------------------------------
| 2 | filename1.txt         |    filename2.txt   |
--------------------------------------------------

Expected output:

 replace filename1.txt filename2.txt

Upvotes: 0

Views: 1088

Answers (2)

RobinHud
RobinHud

Reputation: 11

If i understand your question correctly - its all about concatenate

with concatenate you can merge content of multiple cells' strings , and add more data in between " ", the ',' seperates the values

if A1 will have - "Daddy" and A2 will have "Great" you can write in A3 =CONCATENATE(A1, " is ", A2) and the result of the code will be "Daddy is Great"

so the answer for your request is =concatenate("Replace ", A1," ",A2)

is that what you meant ?

Upvotes: 0

ttaaoossuu
ttaaoossuu

Reputation: 7884

You need this formula:

="replace "&A2&" "&B2

Upvotes: 1

Related Questions