- My Forums
- Tiger Rant
- LSU Recruiting
- SEC Rant
- Saints Talk
- Pelicans Talk
- More Sports Board
- Fantasy Sports
- Golf Board
- Soccer Board
- O-T Lounge
- Tech Board
- Home/Garden Board
- Outdoor Board
- Health/Fitness Board
- Movie/TV Board
- Book Board
- Music Board
- Political Talk
- Money Talk
- Fark Board
- Gaming Board
- Travel Board
- Food/Drink Board
- Ticket Exchange
- TD Help Board
Customize My Forums- View All Forums
- Show Left Links
- Topic Sort Options
- Trending Topics
- Recent Topics
- Active Topics
Started By
Message
Could use some Excel help... SOLVED and THANK YOU
Posted on 3/29/16 at 11:26 pm
Posted on 3/29/16 at 11:26 pm
I'm having a hell of a time getting something to work. I'd like to be able to enter a sentence into Column A and in Column B have it return all of the words from that sentence that are in a list of words from Column X.
Example (input, the numbers on the left are the row numbers):
...Column A
1 Frank drove 12 miles to the store.
2 Jane walked 2 miles to the beach.
3 Kevin flew 800 miles to go on vacation.
4 Sarah drove 15 hours across the state and then ran a marathon.
...Column X
1 walked
2 flew
3 drove
4 ran
5 biked
Example (what I want it to return to me):
...Column B
1 drove
2 walked
3 flew
4 drove, ran
This has been nagging me for a while now. Any help would be much appreciated.
Example (input, the numbers on the left are the row numbers):
...Column A
1 Frank drove 12 miles to the store.
2 Jane walked 2 miles to the beach.
3 Kevin flew 800 miles to go on vacation.
4 Sarah drove 15 hours across the state and then ran a marathon.
...Column X
1 walked
2 flew
3 drove
4 ran
5 biked
Example (what I want it to return to me):
...Column B
1 drove
2 walked
3 flew
4 drove, ran
This has been nagging me for a while now. Any help would be much appreciated.
This post was edited on 3/30/16 at 2:48 pm
Posted on 3/30/16 at 7:11 am to SlapahoeTribe
sorry, not me maynard, BUT
did you think to look on amazon for one of them helper cards in plastic?
I recently bought an old adobe, and a helper card for shortcuts and stuff
it won't hurt to look
did you think to look on amazon for one of them helper cards in plastic?
I recently bought an old adobe, and a helper card for shortcuts and stuff
it won't hurt to look
Posted on 3/30/16 at 8:35 am to SlapahoeTribe
I have no idea what you're asking... Maybe I'm slow, but you have 1 word in column X and are returning 2 words in column B?
Some sort of If statement may help???
Some sort of If statement may help???
Posted on 3/30/16 at 8:42 am to SlapahoeTribe
The first thing that comes to mind is nesting some find and mid commands with if error. How big is the list in column x?
Posted on 3/30/16 at 8:54 am to CubsFanBudMan
Here's a starting point, but there are problems with it. It picked up the ran inside of Frank, so in order to keep that from happening I had to put a space in front of and in back of the words in column x. This means it won't pick up the first or last word in the sentence. Also, it is case specific, so it will not pick up the first word in the sentence. Also, I have extra commas.
=IFERROR(MID(A1,FIND($X$1,A1),LEN($X$1)),"")&","&IFERROR(MID(A1,FIND($X$2,A1),LEN($X$2)),"")&","&IFERROR(MID(A1,FIND($X$3,A1),LEN($X$3)),"")&","&IFERROR(MID(A1,FIND($X$4,A1),LEN($X$4)),"")&","&IFERROR(MID(A1,FIND($X$5,A1),LEN($X$5)),"")
Results:
,, drove ,,
walked ,,,,
, flew ,,,
,, drove , ran ,
Removing all of the commas:
=IFERROR(MID(A1,FIND($X$1,A1),LEN($X$1)),"")&IFERROR(MID(A1,FIND($X$2,A1),LEN($X$2)),"")&IFERROR(MID(A1,FIND($X$3,A1),LEN($X$3)),"")&IFERROR(MID(A1,FIND($X$4,A1),LEN($X$4)),"")&IFERROR(MID(A1,FIND($X$5,A1),LEN($X$5)),"")
Results:
drove
walked
flew
drove ran
=IFERROR(MID(A1,FIND($X$1,A1),LEN($X$1)),"")&","&IFERROR(MID(A1,FIND($X$2,A1),LEN($X$2)),"")&","&IFERROR(MID(A1,FIND($X$3,A1),LEN($X$3)),"")&","&IFERROR(MID(A1,FIND($X$4,A1),LEN($X$4)),"")&","&IFERROR(MID(A1,FIND($X$5,A1),LEN($X$5)),"")
Results:
,, drove ,,
walked ,,,,
, flew ,,,
,, drove , ran ,
Removing all of the commas:
=IFERROR(MID(A1,FIND($X$1,A1),LEN($X$1)),"")&IFERROR(MID(A1,FIND($X$2,A1),LEN($X$2)),"")&IFERROR(MID(A1,FIND($X$3,A1),LEN($X$3)),"")&IFERROR(MID(A1,FIND($X$4,A1),LEN($X$4)),"")&IFERROR(MID(A1,FIND($X$5,A1),LEN($X$5)),"")
Results:
drove
walked
flew
drove ran
Posted on 3/30/16 at 9:37 am to CubsFanBudMan
VBA:
Function GetWords(x As Range, List As Range)
GetWords = ""
For Each y In List.Cells
If InStr(x.Text, " " + y.Text + " ") > 0 Then
If Len(GetWords) > 1 Then
GetWords = GetWords + ", "
End If
GetWords = GetWords + y.Text
End If
Next
End Function
Excel:
=GetWords(A1,$B$1:$B$5)
This doesn't account for multiple uses of the same word but could be easily modified if needed.
Function GetWords(x As Range, List As Range)
GetWords = ""
For Each y In List.Cells
If InStr(x.Text, " " + y.Text + " ") > 0 Then
If Len(GetWords) > 1 Then
GetWords = GetWords + ", "
End If
GetWords = GetWords + y.Text
End If
Next
End Function
Excel:
=GetWords(A1,$B$1:$B$5)
This doesn't account for multiple uses of the same word but could be easily modified if needed.
Posted on 3/30/16 at 10:26 am to SlapahoeTribe
a VBA macro as pointed out by msuhunter is the way to go for this. You could probably do it via functions in the cell but it would probably be long and convoluted.
This post was edited on 3/30/16 at 10:30 am
Posted on 3/30/16 at 12:53 pm to msuhunter
First, thanks for the help.
I took some time at lunch to look at it and using VBA I keep getting a blank cell? I copied the above function exactly.
Perhaps I'm doing something wrong. I don't have that much experience with VBA and have done almost no programming since undergrad years (pushing two decades).

I took some time at lunch to look at it and using VBA I keep getting a blank cell? I copied the above function exactly.
Perhaps I'm doing something wrong. I don't have that much experience with VBA and have done almost no programming since undergrad years (pushing two decades).
Posted on 3/30/16 at 12:57 pm to SlapahoeTribe
send your email to msuhunter at yahoo . com and ill send you the file
Posted on 3/30/16 at 2:46 pm to msuhunter
quote:
msuhunter

Working now, thanks a million!
Popular
Back to top
