Originally Posted by
Rick Rothstein
I am completely clear on what you are doing in your sample, but I do have some comments which might help you in constructing your own formula.
First, I do not see why you are using the INDIRECT function and subtracting numbers from the ROW() function. You know the cells where the data is located, so why not use it directly instead of INDIRECT'ing to them? So, instead of this...
INDIRECT("B"&ROW()-11)
from your formula, use this... B10 (and so forth for the other cells). That would make the formula I posted in Message #2 much easier to read...
=REPLACE(IF(B10="",""," | "&B10)&IF(B11="",""," | "&B11)&IF(B12="",""," | "&B12),1,3,"")
Notice the color three colored sections of code... except for the cell reference, they are identical. That is the key to the formula... just concatenate an identical section for each cell you want to examine (changing the cell referenced in that section, of course). Each colored section is looking at the cell to see if it is blank... if it is, that part of the formula output the empty text string ("") meaning nothing is added to the overall output from that section of the formula. However, if the cell is not blank, then your Space/VerticalLine/Space is concatenated onto the front of the cell reference. This happens for each colored section. So either nothing is outputted form that section or the Vertical Bar surrounded by spaces plus the text from the cell referenced in than section is outputted from that section. Now, once all the sections have been concatenated together, only one Vertical Bar will exist between the outputted text; however, there will be a Space/VerticalBar/Space located at the front of text concatenated together from each colored section, so I used the REPLACE function to remove the first three characters thus giving you the clean text output that you wanted.
Bookmarks