+ Reply to Thread
Results 1 to 9 of 9

Substitute final vowel of text string

  1. #1
    Registered User
    Join Date
    12-27-2020
    Location
    London, England
    MS-Off Ver
    2020
    Posts
    1

    Substitute final vowel of text string

    What formula can I use to substitute the final vowel of a text string with another character?

    For example, the formula should give the following results (if # is the character I want to replace the final vowel)
    orange > orang#
    maroon > maro#n
    red > r#d
    green > gre#n
    pink > p#nk
    brown > br#wn
    Last edited by Henry54289; 12-27-2020 at 01:09 PM.

  2. #2
    Banned User!
    Join Date
    02-06-2020
    Location
    Iowa City, IA, USA
    MS-Off Ver
    2016 - 365 / 2007
    Posts
    2,014

    Re: Substitute final vowel of text string

    VBA does not have an alpha character library sophisticated enough to check for alphabet vowels in a string. thus, you will have to search strings one char by one char, backwards, and check for the first vowel. for instance, if you want to replace the last vowel of 5 strings with the letter ''q'', this would be 1 way:
    Please Login or Register  to view this content.
    wow, now that I realize it, I have written something very long. sorry about that! hope it works. it obviously can be greatly reduced.

  3. #3
    Forum Contributor
    Join Date
    08-26-2016
    Location
    UK
    MS-Off Ver
    O365
    Posts
    260

    Re: Substitute final vowel of text string

    A user-defined function thus:
    Please Login or Register  to view this content.
    Attachment 710556
    Click on the link above to see pic of how to use the udf.

  4. #4
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,787

    Re: Substitute final vowel of text string

    If you have 365 with the dynamic array functions
    =IFERROR(REPLACE(A2,LEN(A2)-AGGREGATE(15,6,SEARCH({"a","e","i","o","u"},CONCAT(MID(A2,SEQUENCE(,LEN(A2),LEN(A2),-1),1))),1)+1,1,"#"),A2)

  5. #5
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2504 (Windows 11 Home 24H2 64-bit)
    Posts
    90,959

    Re: Substitute final vowel of text string

    Administrative Note:

    Welcome to the forum.

    We would very much like to help you with your query, however it has been brought to our attention that the same query has been posted on one or more other forums and you have not provided the required cross-post link(s) here.

    Please see Forum Rule #3 about cross-posting and adjust accordingly. Read this to understand why we (and other sites like us) consider this to be important.

    (Note: this requirement is not optional. As you are new, I will provide the link fir you this time: https://www.reddit.com/r/excel/comme...f_text_string/.)
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help. It's a universal courtesy.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    NB:
    as a Moderator, I never accept friendship requests.
    Forum Rules (updated August 2023): please read them here.

  6. #6
    Registered User
    Join Date
    12-04-2020
    Location
    Bangkok
    MS-Off Ver
    365
    Posts
    61

    Re: Substitute final vowel of text string

    ** Oh, just realized someone already with same method!!! SORRY!!

    Your profile says, MS Ver. 2020, not sure what it is, so I assumed it is MS365, the try this,

    Please Login or Register  to view this content.
    Q06.png
    Last edited by phatdear; 12-28-2020 at 02:14 AM. Reason: Just realized someone already answered with same method.

  7. #7
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,222

    Re: Substitute final vowel of text string

    Please try

    =REPLACE(A2,AGGREGATE(14,6,SEARCH({"a","e","i","o","u"},A2,LEN(A2)-{1;2;3;4;5}),1),1,"#")

    or add more number, but 5 should be enough for normal word

    =REPLACE(A2,AGGREGATE(14,6,SEARCH({"a","e","i","o","u"},A2,LEN(A2)-{1;2;3;4;5;6;7;8;9;10}),1),1,"#")
    Last edited by Bo_Ry; 12-28-2020 at 02:35 AM.

  8. #8
    Registered User
    Join Date
    12-04-2020
    Location
    Bangkok
    MS-Off Ver
    365
    Posts
    61

    Re: Substitute final vowel of text string

    Another approach, in order to be different.

    Please Login or Register  to view this content.

  9. #9
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,710

    Re: Substitute final vowel of text string

    Pl see file.
    In B2 then copy down.

    Please Login or Register  to view this content.
    Attached Files Attached Files
    Pl note
    Array formula should be confirmed with Ctrl+Shift+Enter keys together.
    If answere is satisfactory press * to add reputation.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 2
    Last Post: 09-27-2020, 11:00 PM
  2. Replies: 9
    Last Post: 01-23-2018, 02:52 PM
  3. [SOLVED] Macro to substitute cells with a certain string with other text
    By tisahardknocklife in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-18-2017, 05:23 AM
  4. [SOLVED] Need help completing a formula to find and substitute a character in a text string...
    By danielneedssomehelp in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 08-27-2014, 11:32 AM
  5. Macro to search a string ending with vowel "AEIOUY"
    By kitunga in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-02-2014, 02:37 PM
  6. [SOLVED] Substitute Text String
    By javeds in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 01-13-2014, 10:34 AM
  7. [SOLVED] Substitute a text string with multiple values
    By dihris in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 12-03-2012, 03:25 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1