bookworm121
New Member
- Joined
- Jun 22, 2011
- Messages
- 39
Hi all!
I have 2 columns, C and D.
Basically, column D contains fragments of a sentence. I need to combine these fragments into one cell. The indication of where the beggining and end of the sentence is in column C. When the adjacent cell in column C is NOT empty, this means the sentence starts here. The sentence will continue until the previous adjacent cell from column C is once again NOT empty (non-inclusive). The sentence is built backwards.
For example: (where "nothing" is written indicates a blank cell, where a number is written indicates a non empty cell)
C D
0 random.
nothing The.
nothing sky
nothing is
nothing very
1 Blue
nothing He
In this example, the sentence is "The sky is very blue.". A illustrated, when column C is not blank, the sentence starts, and works backwards until the next non-empty C cell (non-inclusive).
The words "He" and "random." are the beggining and end of 2 different sentences.
I need a macro that would be able to do this on a spreadsheet of any size. This means columns C and D may be 100 rows, 2000 rows, 2 rows or any random number of rows.
I was thinking I need to use "&" somehow, but i really can't seem to wrap my head around how to do this.
Any help would be appreciated! thanks!
I have 2 columns, C and D.
Basically, column D contains fragments of a sentence. I need to combine these fragments into one cell. The indication of where the beggining and end of the sentence is in column C. When the adjacent cell in column C is NOT empty, this means the sentence starts here. The sentence will continue until the previous adjacent cell from column C is once again NOT empty (non-inclusive). The sentence is built backwards.
For example: (where "nothing" is written indicates a blank cell, where a number is written indicates a non empty cell)
C D
0 random.
nothing The.
nothing sky
nothing is
nothing very
1 Blue
nothing He
In this example, the sentence is "The sky is very blue.". A illustrated, when column C is not blank, the sentence starts, and works backwards until the next non-empty C cell (non-inclusive).
The words "He" and "random." are the beggining and end of 2 different sentences.
I need a macro that would be able to do this on a spreadsheet of any size. This means columns C and D may be 100 rows, 2000 rows, 2 rows or any random number of rows.
I was thinking I need to use "&" somehow, but i really can't seem to wrap my head around how to do this.
Any help would be appreciated! thanks!
Last edited: