+ Reply to Thread
Results 1 to 16 of 16

Find a word that has synonyms, in a sentence, and replace it with another word (synonym)

  1. #1
    Registered User
    Join Date
    01-29-2018
    Location
    Denmark
    MS-Off Ver
    2016 Pro
    Posts
    8

    Find a word that has synonyms, in a sentence, and replace it with another word (synonym)

    I am trying to figure this one out and really need some help:

    I need to search a cell (A2) to see if it contains one of the words from a list (C2:C5) if yes, then that word needs to be replaced with one of the other words in the list - randomly (or replaced with the same word).

    I tryed alot of variations but my brain is melting. Can someone nudge in a right direction?

    Excel example: https://ibb.co/gBdOw6

  2. #2
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Find a word that has synonyms, in a sentence, and replace it with another word (synony

    Enter formula in B2 and copy down
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    v A B C
    1 synonyms
    2 This is my first line of text - and it si great one. great big
    3 This was huge achievement for me huge huge
    4 great
    5 enormous
    6
    If you like my answer please click on * Add Reputation
    Don't forget to mark threads as "Solved" if your problem has been resolved

    "Nothing is so firmly believed as what we least know."
    --Michel de Montaigne

  3. #3
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,193

    Re: Find a word that has synonyms, in a sentence, and replace it with another word (synony

    You cannot replace value in A2 but in B2


    =IF(ISNUMBER(SEARCH($C$2:$C$5,A2)),INDEX($C$2:$C$5,RANDBETWEEN(1,4)),"")

  4. #4
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Find a word that has synonyms, in a sentence, and replace it with another word (synony

    It should work with this
    Enter in B2
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    v A B C
    1 synonyms
    2 This is my first line of text - and it is great one. This is my first line of text - and it is huge one. big
    3 This was huge achievement for me This was great achievement for me huge
    4 great
    5 enormous
    Attached Files Attached Files
    Last edited by AlKey; 01-29-2018 at 03:43 PM.

  5. #5
    Registered User
    Join Date
    01-29-2018
    Location
    Denmark
    MS-Off Ver
    2016 Pro
    Posts
    8

    Re: Find a word that has synonyms, in a sentence, and replace it with another word (synony

    This forum is AMAZING

    Alkey thank you for the code and the detailed explanation! I get an error when i paste in your code: https://ibb.co/em75R6 - a value is missing. I do understand parts of it but I am too newbie to be able to debug this one

  6. #6
    Registered User
    Join Date
    01-29-2018
    Location
    Denmark
    MS-Off Ver
    2016 Pro
    Posts
    8

    Re: Find a word that has synonyms, in a sentence, and replace it with another word (synony

    JohnTopley thank you alot for the reply.. your code returns a blanc cell - I wish I could figure out why, my self

  7. #7
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,193

    Re: Find a word that has synonyms, in a sentence, and replace it with another word (synony

    Try

    =IF(SUMPRODUCT(--(ISNUMBER(SEARCH(C2:C5,A2)))),INDEX(C2:C5,RANDBETWEEN(1,4)))

    or obviously use Alkey's!

  8. #8
    Registered User
    Join Date
    01-29-2018
    Location
    Denmark
    MS-Off Ver
    2016 Pro
    Posts
    8

    Re: Find a word that has synonyms, in a sentence, and replace it with another word (synony

    Thanks Alkey! Downloading it an opening in my Excel, it works! - My Excel is not in English, so i testet et in my English Google Sheets and that's where the error came (I thought they worked the same way) - anyways, my Excel translated it to my language and there we go it works!.. thanks agin

  9. #9
    Registered User
    Join Date
    01-29-2018
    Location
    Denmark
    MS-Off Ver
    2016 Pro
    Posts
    8

    Re: Find a word that has synonyms, in a sentence, and replace it with another word (synony

    Thanks for input John Topley

  10. #10
    Registered User
    Join Date
    01-29-2018
    Location
    Denmark
    MS-Off Ver
    2016 Pro
    Posts
    8

    Re: Find a word that has synonyms, in a sentence, and replace it with another word (synony

    If this should work in Google Sheets, would you have to use some other function in another way?

  11. #11
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: Find a word that has synonyms, in a sentence, and replace it with another word (synony

    For Google Sheets use this one
    Formula: copy to clipboard
    Please Login or Register  to view this content.

  12. #12
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,193

    Re: Find a word that has synonyms, in a sentence, and replace it with another word (synony

    The SUMPRODUCT works OK but I did not get Alkey's formula to work but could be my ignorance regarding Google sheets.

    EDIT: Tried Alkey's response but still it does not work (for me!)
    Last edited by JohnTopley; 01-29-2018 at 04:25 PM.

  13. #13
    Registered User
    Join Date
    01-29-2018
    Location
    Denmark
    MS-Off Ver
    2016 Pro
    Posts
    8

    Re: Find a word that has synonyms, in a sentence, and replace it with another word (synony

    Say i wanted to check even more synonyms. Could i just use the same funtion and "combine it 3 times"? How to combine this one?

    Here is an example of what I mean - B2 is the outcome I am trying to accomplish.

    example more variables.JPG

  14. #14
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,193

    Re: Find a word that has synonyms, in a sentence, and replace it with another word (synony

    Please post a file not an image.

    Attach a sample workbook (not image).

    Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate.

    Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.

  15. #15
    Registered User
    Join Date
    01-29-2018
    Location
    Denmark
    MS-Off Ver
    2016 Pro
    Posts
    8

    Re: Find a word that has synonyms, in a sentence, and replace it with another word (synony

    Thank you for instructions. I have made a project Google Sheet - I hope this will make it more easy --> https://docs.google.com/spreadsheets...it?usp=sharing

    Thank you all for input - I am very pleased with all this help i get. +KARMA

  16. #16
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,193

    Re: Find a word that has synonyms, in a sentence, and replace it with another word (synony

    It cannot be done with LOOKUP as this only looks a single row or column. And I don't know how or if it can be done with SUMPRODUCT as it needs to determine which colomn the synonyms are in.

    However, maybe someone will have an answer.
    Last edited by JohnTopley; 01-31-2018 at 12:46 AM.

+ 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: 4
    Last Post: 03-12-2015, 12:45 PM
  2. Find and replace a new sentence or paragraph in word doc
    By krazyhype19 in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 10-03-2014, 06:06 AM
  3. [SOLVED] Find and Replace Exact Word in Sentence.
    By rr1050 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-03-2014, 01:58 AM
  4. Replace word in a sentence
    By dmarop in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-14-2014, 02:50 PM
  5. [SOLVED] Excel macro- Find replace an itallic font word with a regular word?
    By thisisaboutwork in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-08-2013, 01:48 PM
  6. [SOLVED] How can I replace a word from a sentence in a cell & substitute word from another cell
    By rionoah in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 09-11-2012, 08:44 AM
  7. How to find and replace a word in a sentence with VBA
    By Gunilla in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 04-20-2010, 09:52 PM

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