+ Reply to Thread
Results 1 to 13 of 13

Macro to substitute consonants for ? for Boolean search

  1. #1
    Registered User
    Join Date
    07-12-2019
    Location
    Rock Hill, South Carolina
    MS-Off Ver
    Office 365
    Posts
    29

    Macro to substitute consonants for ? for Boolean search

    I am honestly not sure if this is a macro or a formula question.

    My company uses boolean strings a lot to do database searches. But it can be a bit time consuming to constantly type them out. I am hoping that a macro or a formula might help speed the process up.

    If in column A we have the word "formula", in column B I need this to appear "formula OR ?ormula OR fo?mula OR for?ula OR formu?a" so that it can be copied and pasted in our database search engine.

    Our database already has a vowel substitution option so I only need to figure out how to get the consonants to be substituted.

    Any ideas?

    I haven't posted a workbook example because we don't have anything like this. I just want to create a new workbook where we can copy and paste our search terms and get the boolean string.

    Any ideas??

  2. #2
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,316

    Re: Macro to substitute consonants for ? for Boolean search

    I think you will need to post a sample workbook as it appear the next question is: How do I do the same think with a different word? A representative look at your sample will help craft the right response.

    Please see the "Yellow" banner at the top.

    With what you posted...

    =A1& " OR " & SUBSTITUTE(A1,"f","?")& " OR " & SUBSTITUTE(A1,"r","?")& " OR " & SUBSTITUTE(A1,"m","?")& " OR " & SUBSTITUTE(A1,"l","?")
    HTH
    Regards, Jeff

  3. #3
    Registered User
    Join Date
    07-12-2019
    Location
    Rock Hill, South Carolina
    MS-Off Ver
    Office 365
    Posts
    29

    Re: Macro to substitute consonants for ? for Boolean search

    I'm honestly not sure a workbook would help, but here's one.
    In the first column, I have the search terms that we need to run through our database. But we have to have a boolean and break apart the word. Currently, we have to type it all out and manually substitute each consonant. We can't do it all at once because that then creates too many options.
    Attached Files Attached Files

  4. #4
    Forum Guru
    Join Date
    04-23-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 365
    Posts
    2,408

    Re: Macro to substitute consonants for ? for Boolean search

    For the layout shown in your example file, does this macro do what you want (note I outputted to Column D, but you can change that to any other location by modifying the left side of the last line of code)...
    Please Login or Register  to view this content.

  5. #5
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: Macro to substitute consonants for ? for Boolean search

    What is the layout you want the output in? Concatenated all in one cell, separated across columns, separated across rows?

    Concatenated. In D5 and filled down
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Edit or since you have Office 365 this is easier
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Last edited by FlameRetired; 03-04-2020 at 05:59 PM.
    Dave

  6. #6
    Registered User
    Join Date
    07-12-2019
    Location
    Rock Hill, South Carolina
    MS-Off Ver
    Office 365
    Posts
    29
    Thanks Dave.

    The output I am hoping to get is what is in the second column. The long text string with all the ?’s. The goal is to have our search term, in this example formula, repeated, and in each new repetition, have one of the consonants replaced with a ? And separated by “OR”
    Last edited by jeffreybrown; 03-04-2020 at 06:23 PM.

  7. #7
    Registered User
    Join Date
    07-12-2019
    Location
    Rock Hill, South Carolina
    MS-Off Ver
    Office 365
    Posts
    29
    Thanks Rick,

    I’ll give this a try and let you know!!
    Last edited by jeffreybrown; 03-04-2020 at 06:23 PM. Reason: Please try to avoid using full quotes!

  8. #8
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,316

    Re: Macro to substitute consonants for ? for Boolean search

    Very nice Rick and thanks for the assist.

    Dave, thank you also, but since I do not have 365, I will not be able to follow you here.
    Last edited by FlameRetired; 03-04-2020 at 06:33 PM.

  9. #9
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,316

    Re: Macro to substitute consonants for ? for Boolean search

    Hi hadydea,

    Please don't quote whole posts -- it's just clutter.*If you are responding to a post out of sequence, limit quoted content to a few relevant lines that makes clear to whom and what you are responding.

  10. #10
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: Macro to substitute consonants for ? for Boolean search

    Quote Originally Posted by hadydea View Post
    Thanks Dave.

    The output I am hoping to get is what is in the second column. The long text string with all the ?’s. The goal is to have our search term, in this example formula, repeated, and in each new repetition, have one of the consonants replaced with a ? And separated by “OR”
    In that case this small adjustment.
    Formula: copy to clipboard
    Please Login or Register  to view this content.

  11. #11
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: Macro to substitute consonants for ? for Boolean search

    Quote Originally Posted by jeffreybrown View Post
    ...
    Dave, thank you also, but since I do not have 365, I will not be able to follow you here.
    Ooops. I started to edit your post with this

    Is these cases I use tigeravatar's CONCATALL Udf.
    Please Login or Register  to view this content.

    Then the formula array entered: Edited for the wildcard "?".


    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Last edited by FlameRetired; 03-04-2020 at 06:43 PM.

  12. #12
    Registered User
    Join Date
    07-12-2019
    Location
    Rock Hill, South Carolina
    MS-Off Ver
    Office 365
    Posts
    29

    Re: Macro to substitute consonants for ? for Boolean search

    I can't see if my reply went through, but this worked!!!!
    THANK YOU SO SO SO MUCH!

    YOU ARE A MAGICAL WIZARD!!

  13. #13
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,316

    Re: Macro to substitute consonants for ? for Boolean search

    You are very welcome. We are happy to help and thanks for the feedback.

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED.

    Also, as a relatively new member of the forum, you may not be aware that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of those who helped.

+ 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. Boolean search - AND, NOT, and OR
    By nobleprince in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-06-2019, 05:37 PM
  2. [SOLVED] Are first 2 letter consonants ?
    By makinmomb in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 05-10-2017, 04:24 AM
  3. Macro to delete consonants
    By makinmomb in forum Excel Programming / VBA / Macros
    Replies: 19
    Last Post: 04-11-2017, 01:58 AM
  4. [SOLVED] Exit Workbook_BeforeClose(Cancel As Boolean) if a public boolean = true
    By meabrams in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-20-2016, 06:10 AM
  5. Help: Trying to boolean search down a column and note matches.
    By LightingPop in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 11-25-2012, 09:47 PM
  6. Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean) problem
    By 2funny4words in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-29-2009, 07:28 PM
  7. Name Search in Excel User Sheet / Boolean?
    By Peter1999 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-27-2007, 07:41 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