F
frustratedwthis
Is there a way to concatenate 2 rows of information AND the name of the sheet?
Thank you for your help in advance!
Thank you for your help in advance!
=RIGHT(CELL("filename"),LEN(CELL("filename"))-FIND("]",CELL("filename")))
JLatham said:I hope you mean information from two cells, not two complete rows.
I'll go
on that premise:
A formula that will return the name of the sheet it in is this:
=RIGHT(CELL("filename"),LEN(CELL("filename"))-FIND("]",CELL("filename")))
To concatenate two or more values from cells you can use the
CONCATENATE()
function or do it another way. I'll show both. I will also presume
you wish
to have a dash (-) separating the items concatenated. That makes
things a
little easier to see and understand here. You can substitute anything
for
the dash including a space or just leave that part out of the
concatenation
completely.
Assume that you are in cell A2 and want to concatenate A1 and B1 along
with
the sheet name.
=CONCATENATE(A1,"-",B1,"-",RIGHT(CELL("filename"),LEN(CELL("filename"))-FIND("]",CELL("filename"))))
you can do the same thing without the CONCATENATE statement as:
=A1 & "-" & B1 & "-" &
RIGHT(CELL("filename"),LEN(CELL("filename"))-FIND("]",CELL("filename")))
Hope that helps reduce the frustration level a little.
frustratedwthis said:Is there a way to concatenate 2 rows of information AND the name of
the sheet?
Thank you for your help in advance!
JLatham said:I hope you mean information from two cells, not two complete rows. I'll go
on that premise:
A formula that will return the name of the sheet it in is this:
=RIGHT(CELL("filename"),LEN(CELL("filename"))-FIND("]",CELL("filename")))
To concatenate two or more values from cells you can use the CONCATENATE()
function or do it another way. I'll show both. I will also presume you wish
to have a dash (-) separating the items concatenated. That makes things a
little easier to see and understand here. You can substitute anything for
the dash including a space or just leave that part out of the concatenation
completely.
Assume that you are in cell A2 and want to concatenate A1 and B1 along with
the sheet name.
=CONCATENATE(A1,"-",B1,"-",RIGHT(CELL("filename"),LEN(CELL("filename"))-FIND("]",CELL("filename"))))
you can do the same thing without the CONCATENATE statement as:
=A1 & "-" & B1 & "-" &
RIGHT(CELL("filename"),LEN(CELL("filename"))-FIND("]",CELL("filename")))
Hope that helps reduce the frustration level a little.
frustratedwthis said:Is there a way to concatenate 2 rows of information AND the name of the sheet?
Thank you for your help in advance!
A little caveat I forgot to mention. The CELL("filename") formula does not
return anything until the workbook has been saved to disk. That is to say,
if you open Excel and immediately type that formula into a cell, nothing will
show up. But if you save the workbook (or open one already on disk) it will
work, although when you save a new one you may need to use [F9] to get it to
appear.
Also, it can change if you have two or more workbooks open using the format
I gave earlier. To prevent that, add the address of the cell you type the
formula into to the formula. Assuming the formula will go into cell A2,
change all references to
CELL("filename")
to
CELL("filename",A2)
frustratedwthis said:Is there a way to concatenate 2 rows of information AND the name of the sheet?
Thank you for your help in advance!
Dave Peterson said:Since =cell("filename") returns the complete path, workbook name and worksheet
name, it may return the wrong worksheet name--even if there is only one workbook
open.
That function returns the name of the sheet that is active when the formula
recalculated.
You can see it by creating (and saving) a workbook with two worksheets.
Put that formula in A1 of each sheet.
Then window|New window
followed by window|arrange|horizontal.
Activate one window and recalc. And look at the results in the other window.
Activate the other window and recalc and look at the other window.
Unless you're doing something very special, you should include that range
reference in the formula.
I tend to use
=cell("Filename",a1)
but the address doesn't really matter--as long as you don't delete it!
A little caveat I forgot to mention. The CELL("filename") formula does not
return anything until the workbook has been saved to disk. That is to say,
if you open Excel and immediately type that formula into a cell, nothing will
show up. But if you save the workbook (or open one already on disk) it will
work, although when you save a new one you may need to use [F9] to get it to
appear.
Also, it can change if you have two or more workbooks open using the format
I gave earlier. To prevent that, add the address of the cell you type the
formula into to the formula. Assuming the formula will go into cell A2,
change all references to
CELL("filename")
to
CELL("filename",A2)
frustratedwthis said:Is there a way to concatenate 2 rows of information AND the name of the sheet?
Thank you for your help in advance!