Return Nth word from the RIGHT

Keti89

New Member
Joined
Feb 8, 2018
Messages
10
Hello Everyone,

After a lot of thinking and reading I could not find a solution, so I thought someone might be able to help.

I managed to return first and last word from a cell, even managed to return the Nth word from a text, but could not manage to find a function to return Nth word, if looking from the right to the left within a cell.

Basically, I need this, because the position within which the value I need is found is only FIX from the right (as in the middle of the strings there is a variable character count, so the length is different in every row)

Get first word
=LEFT(B2,FIND(" ",B2)-1)

Get last word
=TRIM(RIGHT(SUBSTITUTE(TRIM(B6)," ",REPT(" ",100)),100))

Extract Nth word from string
=TRIM(MID(SUBSTITUTE(A1," ",REPT(" ",LEN(A1))), (N-1)*LEN(A1)+1, LEN(A1)))

(Credit goes to Dave Bruns' Exceljet for most of the above.)

All the Best,

Tibi
 
What about these???
What about them?
Based on the original post, why would you think the OP's data is something other than words separated by space(s) ?
If that's the case, he will surely post again.
 
Last edited:
Upvote 0

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
What about them?
Based on the original post, why would you think the OP's data is something other than words separated by space(s) ?
If that's the case, he will surely post again.

Because I've seen many. Don't want to HiJack this post on a trivial matter, I'm Out.
 
Upvote 0
What about these???

Let's not guess what OP is asking, OP needs to specify the question as I asked in post #3.

A guess?
Don't you mean an extremely likely understanding of the OP's requirement
 
Upvote 0
Thanks Everyone for the massive input, much appreciated!

Yes, you can assume all the words are separated by a SPACE, as I think that is the case in every scenario! Although, if there is more than 1 space, I could perhaps substitute all the space strings with 1 space (the separator is always a space, so no other characters, in this case at least).

The problem with a simple example.

Finding Nth from the left sometimes will not work, because in the middle of the string there are sections where the number of words vary, so in these cases I would need to count from the right.

Example:

1.0 47% Ask for Help 10 Excel
2.0 47% Thank you for the help 20 Excel
3.0 47% It is always very nice to discuss 30 Excel

I would want to extract 10,20 and 30, so the second word from the right.

Al the Best,

Tibi
 
Upvote 0
Yes! Was just checking the details on that and it seems to be working correctly, so thanks a lot, Wideboydixon!

Also, I just wanted to reflect on the fact that there is no clear cut solution, the ones I brought in were examples, assuming the methodology will be similar.
But hey, this space for creativity is what makes this fun. :)
 
Upvote 0
Actually, both this one and the one in post #2 by footoo work, so thanks for the inputs and great solutions. This really shows that even a very complex issue can have multiple, creative solutions.
 
Upvote 0

Forum statistics

Threads
1,224,828
Messages
6,181,206
Members
453,022
Latest member
RobertV1609

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top