Formula to search for words in a cell from a list

sobrien1234

Board Regular
Joined
May 10, 2016
Messages
175
Office Version
  1. 365
Platform
  1. Windows
I need a formula in column B to identify if words in columns A are identified in C2:
For example:
In column A I have a list of words
In C2 I have a sentence
In column B I have a formula which identifies if any of the words in column A are identified in the text in C2
Not sure if I need to have a space or not after the commas for the words in Column A?
1622598064122.png


Thanks

Seamus
 
didn't work

The formula didn't appear to work
Unfortunately I cannot see which formula you were referring to in each of these cases. Further, I don't have your sample data to test with as I cannot copy from an image. Hence my earlier suggestion for using XL2BB which allows for copying of both data and formulas.
 
Upvote 0

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
Unfortunately I cannot see which formula you were referring to in each of these cases. Further, I don't have your sample data to test with as I cannot copy from an image. Hence my earlier suggestion for using XL2BB which allows for copying of both data and formulas.
Ok try this - on columns D:G I have a formula which works it out but is a bit clunky. Your formula is in column H. Thanks again!

Test 1.xlsx
ABCDEFGH
1FileGoalsDic1LRBALBRARecourseAnswerFormula
210000233Establish SMSF for residential property investment. LRBA/borrowing advice, with cash flow analysis. Rollover your existing super account/s into your SMSF. Keep the existing insurances in the super account/s being rolled over.LRBA, LBRA, RecourseTRUEFALSEFALSE10
310000234To purchase an investment property using your super by setting up a SMSF & utilising an LRBA.LRBA, LBRA, RecourseTRUEFALSEFALSE10
410000304Purchase a commercial property in your existing self-managed super fund, using a limited recourse borrowing arrangement.LRBA, LBRA, RecourseFALSEFALSETRUE10
510000319To purchase a commercial property in your existing self-managed super fund, using a limited recourse borrowing arrangement.LRBA, LBRA, RecourseFALSEFALSETRUE10
610000328Would like to buy business real property using current SMSF and LRBA. More control and minimise tax for super investments. Flexibility and ease of administration of super. Like to buy a property in super. Maximise superannuation benefits.LRBA, LBRA, RecourseTRUEFALSEFALSE10
710001190You would like to establish a Self Managed Superannuation Fund (SMSF). You wish to purchase an investment property within your newly established SMSF and utilise a borrowing arrangement to do so. However, as discussed, you are not seeking nor are we providing advice regarding which specific property to purchase or the limited recourse borrowing arrangement (LRBA) within your SMSF. You would like to review your existing Q Super superannuation arrangement in light of establishing an SMSF and would like to retain your existing insurance policies within your current Q Super fund. You wish to commence making salary sacrifice contributions into your newly established SMSF to help pay off the investment property within the next 10 years. You wish to put in place a plan for estate planning.LRBA, LBRA, RecourseTRUEFALSETRUE10
810002822We wish to take out a loan to purchase a property through President Superannuation Fund that will be leased to Shamus's business, Watkins Real Estate. Shamus would like assistance with the loan application and structuring this purchase correctly under the SIS Legislation. Would like to know about the most tax effective contributions to make each financial year to ensure that you maintain sufficient funds to meet limited recourse repayments.LRBA, LBRA, RecourseFALSEFALSETRUE10
910002977You wish to establish a self-managed super fund (SMSF). You would like to have more control cover the investment decisions of the funds; in particular, the ability to invest in property. You would like to buy a residential property and use limited recourse borrowing arrangement (LRBA) to assist with the property purchase. You want to contribute up to the maximum concessional contributions each year.LRBA, LBRA, RecourseTRUEFALSETRUE10
1010003200You wish to establish a self-managed super fund (SMSF). You would like to have more control cover the investment decisions of the funds; in particular, the ability to invest in property. You would like to buy a residential property and use limited recourse borrowing arrangement (LRBA) to assist with the property purchase. You want to contribute up to the maximum concessional contributions each year.LRBA, LBRA, RecourseTRUEFALSETRUE10
1110003657Requested my assistance in establishing an SMSF to acquire the commercial premises for existing business (Reaper Performance Diesel) to continue to operate business out of. You strongly believe this type of investment will bring rental return (that you are already paying to an external third party) and the capital growth that will assist in building superannuation balance and savings for retirement. Contribute additional funds into super. We understand you wish to contribute additional funds into super to reduce the tax you are paying personally and to build superannuation to a position where it is sufficient to assist with the purchase of the commercial premises. Have greater control over decisions and the investments made with superannuation savings. Undertake the commercial premises acquisition you will require this strategy to incorporate an element of bank lending. Accordingly, this strategy will need to utilise a limited recourse borrowing arrangement. Roll existing superannuation held with MTAA into own SMSF so you can invest in property.LRBA, LBRA, RecourseFALSEFALSETRUE10
1210003934Soheil & Maryam, you would like to establish a Self-Managed Super Fund to facilitate the purchase of your chosen investment property in Burpengary for $330,000 by January 2021.. Soheil & Maryam, you would like to establish a Limited Recourse Borrowing Arrangement as your combined superannuation amount of approx. $234,000 isn’t sufficient to purchase the chosen investment property in Burpengary for $330,000 by January 2021. Soheil & Maryam, you would like to transfer as much of your super funds as possible over to your new SMSF without losing any insurance benefits. Soheil & Maryam, based on the analysis of your insurance needs, in the event of death, you would both like to have funds available to pay out your home loan of approx. $490,000 provide $10,000 for funeral costs. Based on the analysis of your insurance needs, in the event of permanent disability, your main objective is to have funds available to pay out your home loan of approx. $490,000. This will also provide your family with a lump sum of $10,000 to cover ongoing medical expenses. You would like to implement an Any Occupation TPD policy as this lowers the cost of premiums. Soheil, in the event of being unable to work due to illness or injury, you would like to have cover in place that will provide a replacement income of the maximum 75% of your salary, $10,950 per month (based on your existing salary of $160,000), with a waiting period of 60 days and benefit period of 5 years. Maryam, the recommended insurance portfolio is not enough to provide you with full financial security in the event of death, disability or illness. We believe you are over exposed to the risks, however we are unable to apply for new Income Protection cover whilst you are out of the workforce. You would like to hold Life, TPD and Income Protection insurances within super to limit the impact on your cash flow. Soheil, you would like our advice regarding salary sacrifice, and whether you can take advantage of tax savings, and whether this can help you to pay down the loan of your investment property in a shorter time frame. You are aware that you may need to make additional contributions to super in order to assist the cashflow of your SMSF and ongoing expenses. You would like my recommendations on the type of death benefit nomination you should make on your super fund, and any other estate planning considerations to be made.LRBA, LBRA, RecourseFALSEFALSETRUE10
1310004520• Pete and Sharon are not comfortable with their superannuation benefits being invested in equities due to their limited understanding of that type of investment and also the continued volatility of the stock market. They have a number of investment properties between them and are well versed in what is required to management them. They understand real estate investment and have done extensive research into the real estate market and the opportunities that exist in the area they are considering at Twin Waters on the Sunshine Coast in Queensland. Their research has shown significant demand for both permanent and short term rental in this area and also potential for very good capital growth. • They would like to set up an SMSF and do a partial rollover of their existing super balances leaving enough in their current funds to cover ongoing life insurance premiums. They would then like to buy an investment property (townhouse) in Twin Waters using a related party LRBA.LRBA, LBRA, RecourseTRUEFALSEFALSE10
1410005212Steve and Kerry you would like the choice to be able to retire in 10 years. The objective is to pay down all debt outside super and then drop to part time. Steve, you advised that you will not be able to give up work entirely, but you would like to be able to work less. You would both like less financial stress and the ability to travel. You will require around $60,000 (net) in today’s dollars. You would like to review your estate planning arrangements to ensure your assets and wishes are carried out accordingly. Steve and Kerry, you would like to establish an SMSF and purchase a commercial properly for Steve to run his hair salon from. You do not want to continue leasing a space when you could be contributing the rent to your proposed SMSF. You are keen to consolidate your super and you would like advice on how to go about this along with purchasing a property through an LRBA. You would like to know how much you can afford to spend on a property and if the cashflow would support stress-testing. You would also like advice on contributing extra to super to boost your balances and sauce tax. Following discussions with you, you no longer wish to establish a SMSF for the purposes of purchasing a commercial property with debt. You now wish to ensure your funds are invested appropriately given your risk profile and ethical investment beliefs, in a competitively priced product with sound features and qualities. Although not specifically requested I believe it is pertinent to review your debt and cash flow as part of the strategy to ensure you can afford super contributions and pay down your mortgage. Although the scope has been limited, I believe reviewing insurance is necessary especially with regard to leveraging inside super. Further to your decision to purchase the commercial property outside of superannuation, I believe it is necessary to ensure the loan for the property is able to be paid out in the event of either of your death or total and permanent disablement.LRBA, LBRA, RecourseTRUEFALSEFALSE10
Sheet1
Cell Formulas
RangeFormula
D2:F14D2=ISNUMBER(SEARCH(D$1,$B2))
G2:G14G2=IF(COUNTIF(D2:F2,TRUE)>0,1,0)
H2:H14H2=IF(COUNT(FIND(" "&FILTERXML("<p><c>"&SUBSTITUTE($B2," ","</c><c>")&"</c></p>","//c")&","," "&$C$3&",")),1,0)
 
Upvote 0
Thanks for the XL2BB data. The issue is that we are running into a string length limit with the FILTERXML function due to the length of the column B text.
Will the Dic1 list(s) always be fairly short like that sample? If so we can swap the direction of the sort.

sobrien1234.xlsm
BCD
1GoalsDic1
2Establish SMSF for residential property investment. LRBA/borrowing advice, with cash flow analysis. Rollover your existing super account/s into your SMSF. Keep the existing insurances in the super account/s being rolled over.LRBA, LBRA, Recourse1
3To purchase an investment property using your super by setting up a SMSF & utilising an LRBA.1
4Purchase a commercial property in your existing self-managed super fund, using a limited recourse borrowing arrangement.1
5To purchase a commercial property in your existing self-managed super fund, using a limited recourse borrowing arrangement.1
6Would like to buy business real property using current SMSF and LRBA. More control and minimise tax for super investments. Flexibility and ease of administration of super. Like to buy a property in super. Maximise superannuation benefits.1
7You would like to establish a Self Managed Superannuation Fund (SMSF). You wish to purchase an investment property within your newly established SMSF and utilise a borrowing arrangement to do so. However, as discussed, you are not seeking nor are we providing advice regarding which specific property to purchase or the limited recourse borrowing arrangement (LRBA) within your SMSF. You would like to review your existing Q Super superannuation arrangement in light of establishing an SMSF and would like to retain your existing insurance policies within your current Q Super fund. You wish to commence making salary sacrifice contributions into your newly established SMSF to help pay off the investment property within the next 10 years. You wish to put in place a plan for estate planning.1
Sheet1
Cell Formulas
RangeFormula
D2:D7D2=--(COUNT(SEARCH(" "&FILTERXML("<p><c>"&SUBSTITUTE(C$2,",","</c><c>")&"</c></p>","//c")&","," "&SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(B2,"."," "),"/"," ")," ",", ")&","))>0)


If the Dic1 list ends up causing the same text length issue then I think you would have to change to a vba or possibly a power query solution.
Would vba be acceptable?
 
Upvote 0
Ok try this - on columns D:G I have a formula which works it out but is a bit clunky. Your formula is in column H. Thanks again!

Test 1.xlsx
ABCDEFGH
1FileGoalsDic1LRBALBRARecourseAnswerFormula
210000233Establish SMSF for residential property investment. LRBA/borrowing advice, with cash flow analysis. Rollover your existing super account/s into your SMSF. Keep the existing insurances in the super account/s being rolled over.LRBA, LBRA, RecourseTRUEFALSEFALSE10
310000234To purchase an investment property using your super by setting up a SMSF & utilising an LRBA.LRBA, LBRA, RecourseTRUEFALSEFALSE10
410000304Purchase a commercial property in your existing self-managed super fund, using a limited recourse borrowing arrangement.LRBA, LBRA, RecourseFALSEFALSETRUE10
510000319To purchase a commercial property in your existing self-managed super fund, using a limited recourse borrowing arrangement.LRBA, LBRA, RecourseFALSEFALSETRUE10
610000328Would like to buy business real property using current SMSF and LRBA. More control and minimise tax for super investments. Flexibility and ease of administration of super. Like to buy a property in super. Maximise superannuation benefits.LRBA, LBRA, RecourseTRUEFALSEFALSE10
710001190You would like to establish a Self Managed Superannuation Fund (SMSF). You wish to purchase an investment property within your newly established SMSF and utilise a borrowing arrangement to do so. However, as discussed, you are not seeking nor are we providing advice regarding which specific property to purchase or the limited recourse borrowing arrangement (LRBA) within your SMSF. You would like to review your existing Q Super superannuation arrangement in light of establishing an SMSF and would like to retain your existing insurance policies within your current Q Super fund. You wish to commence making salary sacrifice contributions into your newly established SMSF to help pay off the investment property within the next 10 years. You wish to put in place a plan for estate planning.LRBA, LBRA, RecourseTRUEFALSETRUE10
810002822We wish to take out a loan to purchase a property through President Superannuation Fund that will be leased to Shamus's business, Watkins Real Estate. Shamus would like assistance with the loan application and structuring this purchase correctly under the SIS Legislation. Would like to know about the most tax effective contributions to make each financial year to ensure that you maintain sufficient funds to meet limited recourse repayments.LRBA, LBRA, RecourseFALSEFALSETRUE10
910002977You wish to establish a self-managed super fund (SMSF). You would like to have more control cover the investment decisions of the funds; in particular, the ability to invest in property. You would like to buy a residential property and use limited recourse borrowing arrangement (LRBA) to assist with the property purchase. You want to contribute up to the maximum concessional contributions each year.LRBA, LBRA, RecourseTRUEFALSETRUE10
1010003200You wish to establish a self-managed super fund (SMSF). You would like to have more control cover the investment decisions of the funds; in particular, the ability to invest in property. You would like to buy a residential property and use limited recourse borrowing arrangement (LRBA) to assist with the property purchase. You want to contribute up to the maximum concessional contributions each year.LRBA, LBRA, RecourseTRUEFALSETRUE10
1110003657Requested my assistance in establishing an SMSF to acquire the commercial premises for existing business (Reaper Performance Diesel) to continue to operate business out of. You strongly believe this type of investment will bring rental return (that you are already paying to an external third party) and the capital growth that will assist in building superannuation balance and savings for retirement. Contribute additional funds into super. We understand you wish to contribute additional funds into super to reduce the tax you are paying personally and to build superannuation to a position where it is sufficient to assist with the purchase of the commercial premises. Have greater control over decisions and the investments made with superannuation savings. Undertake the commercial premises acquisition you will require this strategy to incorporate an element of bank lending. Accordingly, this strategy will need to utilise a limited recourse borrowing arrangement. Roll existing superannuation held with MTAA into own SMSF so you can invest in property.LRBA, LBRA, RecourseFALSEFALSETRUE10
1210003934Soheil & Maryam, you would like to establish a Self-Managed Super Fund to facilitate the purchase of your chosen investment property in Burpengary for $330,000 by January 2021.. Soheil & Maryam, you would like to establish a Limited Recourse Borrowing Arrangement as your combined superannuation amount of approx. $234,000 isn’t sufficient to purchase the chosen investment property in Burpengary for $330,000 by January 2021. Soheil & Maryam, you would like to transfer as much of your super funds as possible over to your new SMSF without losing any insurance benefits. Soheil & Maryam, based on the analysis of your insurance needs, in the event of death, you would both like to have funds available to pay out your home loan of approx. $490,000 provide $10,000 for funeral costs. Based on the analysis of your insurance needs, in the event of permanent disability, your main objective is to have funds available to pay out your home loan of approx. $490,000. This will also provide your family with a lump sum of $10,000 to cover ongoing medical expenses. You would like to implement an Any Occupation TPD policy as this lowers the cost of premiums. Soheil, in the event of being unable to work due to illness or injury, you would like to have cover in place that will provide a replacement income of the maximum 75% of your salary, $10,950 per month (based on your existing salary of $160,000), with a waiting period of 60 days and benefit period of 5 years. Maryam, the recommended insurance portfolio is not enough to provide you with full financial security in the event of death, disability or illness. We believe you are over exposed to the risks, however we are unable to apply for new Income Protection cover whilst you are out of the workforce. You would like to hold Life, TPD and Income Protection insurances within super to limit the impact on your cash flow. Soheil, you would like our advice regarding salary sacrifice, and whether you can take advantage of tax savings, and whether this can help you to pay down the loan of your investment property in a shorter time frame. You are aware that you may need to make additional contributions to super in order to assist the cashflow of your SMSF and ongoing expenses. You would like my recommendations on the type of death benefit nomination you should make on your super fund, and any other estate planning considerations to be made.LRBA, LBRA, RecourseFALSEFALSETRUE10
1310004520• Pete and Sharon are not comfortable with their superannuation benefits being invested in equities due to their limited understanding of that type of investment and also the continued volatility of the stock market. They have a number of investment properties between them and are well versed in what is required to management them. They understand real estate investment and have done extensive research into the real estate market and the opportunities that exist in the area they are considering at Twin Waters on the Sunshine Coast in Queensland. Their research has shown significant demand for both permanent and short term rental in this area and also potential for very good capital growth. • They would like to set up an SMSF and do a partial rollover of their existing super balances leaving enough in their current funds to cover ongoing life insurance premiums. They would then like to buy an investment property (townhouse) in Twin Waters using a related party LRBA.LRBA, LBRA, RecourseTRUEFALSEFALSE10
1410005212Steve and Kerry you would like the choice to be able to retire in 10 years. The objective is to pay down all debt outside super and then drop to part time. Steve, you advised that you will not be able to give up work entirely, but you would like to be able to work less. You would both like less financial stress and the ability to travel. You will require around $60,000 (net) in today’s dollars. You would like to review your estate planning arrangements to ensure your assets and wishes are carried out accordingly. Steve and Kerry, you would like to establish an SMSF and purchase a commercial properly for Steve to run his hair salon from. You do not want to continue leasing a space when you could be contributing the rent to your proposed SMSF. You are keen to consolidate your super and you would like advice on how to go about this along with purchasing a property through an LRBA. You would like to know how much you can afford to spend on a property and if the cashflow would support stress-testing. You would also like advice on contributing extra to super to boost your balances and sauce tax. Following discussions with you, you no longer wish to establish a SMSF for the purposes of purchasing a commercial property with debt. You now wish to ensure your funds are invested appropriately given your risk profile and ethical investment beliefs, in a competitively priced product with sound features and qualities. Although not specifically requested I believe it is pertinent to review your debt and cash flow as part of the strategy to ensure you can afford super contributions and pay down your mortgage. Although the scope has been limited, I believe reviewing insurance is necessary especially with regard to leveraging inside super. Further to your decision to purchase the commercial property outside of superannuation, I believe it is necessary to ensure the loan for the property is able to be paid out in the event of either of your death or total and permanent disablement.LRBA, LBRA, RecourseTRUEFALSEFALSE10
Sheet1
Cell Formulas
RangeFormula
D2:F14D2=ISNUMBER(SEARCH(D$1,$B2))
G2:G14G2=IF(COUNTIF(D2:F2,TRUE)>0,1,0)
H2:H14H2=IF(COUNT(FIND(" "&FILTERXML("<p><c>"&SUBSTITUTE($B2," ","</c><c>")&"</c></p>","//c")&","," "&$C$3&",")),1,0)

Thanks for the XL2BB data. The issue is that we are running into a string length limit with the FILTERXML function due to the length of the column B text.
Will the Dic1 list(s) always be fairly short like that sample? If so we can swap the direction of the sort.

sobrien1234.xlsm
BCD
1GoalsDic1
2Establish SMSF for residential property investment. LRBA/borrowing advice, with cash flow analysis. Rollover your existing super account/s into your SMSF. Keep the existing insurances in the super account/s being rolled over.LRBA, LBRA, Recourse1
3To purchase an investment property using your super by setting up a SMSF & utilising an LRBA.1
4Purchase a commercial property in your existing self-managed super fund, using a limited recourse borrowing arrangement.1
5To purchase a commercial property in your existing self-managed super fund, using a limited recourse borrowing arrangement.1
6Would like to buy business real property using current SMSF and LRBA. More control and minimise tax for super investments. Flexibility and ease of administration of super. Like to buy a property in super. Maximise superannuation benefits.1
7You would like to establish a Self Managed Superannuation Fund (SMSF). You wish to purchase an investment property within your newly established SMSF and utilise a borrowing arrangement to do so. However, as discussed, you are not seeking nor are we providing advice regarding which specific property to purchase or the limited recourse borrowing arrangement (LRBA) within your SMSF. You would like to review your existing Q Super superannuation arrangement in light of establishing an SMSF and would like to retain your existing insurance policies within your current Q Super fund. You wish to commence making salary sacrifice contributions into your newly established SMSF to help pay off the investment property within the next 10 years. You wish to put in place a plan for estate planning.1
Sheet1
Cell Formulas
RangeFormula
D2:D7D2=--(COUNT(SEARCH(" "&FILTERXML("<p><c>"&SUBSTITUTE(C$2,",","</c><c>")&"</c></p>","//c")&","," "&SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(B2,"."," "),"/"," ")," ",", ")&","))>0)


If the Dic1 list ends up causing the same text length issue then I think you would have to change to a vba or possibly a power query solution.
Would vba be acceptable?

Thanks for the XL2BB data. The issue is that we are running into a string length limit with the FILTERXML function due to the length of the column B text.
Will the Dic1 list(s) always be fairly short like that sample? If so we can swap the direction of the sort.

sobrien1234.xlsm
BCD
1GoalsDic1
2Establish SMSF for residential property investment. LRBA/borrowing advice, with cash flow analysis. Rollover your existing super account/s into your SMSF. Keep the existing insurances in the super account/s being rolled over.LRBA, LBRA, Recourse1
3To purchase an investment property using your super by setting up a SMSF & utilising an LRBA.1
4Purchase a commercial property in your existing self-managed super fund, using a limited recourse borrowing arrangement.1
5To purchase a commercial property in your existing self-managed super fund, using a limited recourse borrowing arrangement.1
6Would like to buy business real property using current SMSF and LRBA. More control and minimise tax for super investments. Flexibility and ease of administration of super. Like to buy a property in super. Maximise superannuation benefits.1
7You would like to establish a Self Managed Superannuation Fund (SMSF). You wish to purchase an investment property within your newly established SMSF and utilise a borrowing arrangement to do so. However, as discussed, you are not seeking nor are we providing advice regarding which specific property to purchase or the limited recourse borrowing arrangement (LRBA) within your SMSF. You would like to review your existing Q Super superannuation arrangement in light of establishing an SMSF and would like to retain your existing insurance policies within your current Q Super fund. You wish to commence making salary sacrifice contributions into your newly established SMSF to help pay off the investment property within the next 10 years. You wish to put in place a plan for estate planning.1
Sheet1
Cell Formulas
RangeFormula
D2:D7D2=--(COUNT(SEARCH(" "&FILTERXML("<p><c>"&SUBSTITUTE(C$2,",","</c><c>")&"</c></p>","//c")&","," "&SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(B2,"."," "),"/"," ")," ",", ")&","))>0)


If the Dic1 list ends up causing the same text length issue then I think you would have to change to a vba or possibly a power query solution.
Would vba be acceptable?
You're a genius!! Thank you!

Dic 1 could end up being quite long however in the first example we looked at dic 1 was over several cells in the same column. Will this formula still work if we have dic1 set out as below (i've just made up some additional names from C3:C6 so that it returns a 1 if any of these words appears? This is because I have other questions where I want to identify if certain company names are used. This might end up being maybe 50 companies but they might have 2-3 different ways of saying them. I have used macros before but I don't know how to write any code but I do know how to record them - so I am a VBA novice at best but if you think this will be better let me know. I'm a keen learner. Thanks again you're a champion.

Test 1.xlsx
ABCD
1FileGoalsDic1Formula
210000233Establish SMSF for residential property investment. LRBA/borrowing advice, with cash flow analysis. Rollover your existing super account/s into your SMSF. Keep the existing insurances in the super account/s being rolled over.LRBA, LBRA, Recourse1
310000234To purchase an investment property using your super by setting up a SMSF & utilising an LRBA.HUB24, HUB 241
410000304Purchase a commercial property in your existing self-managed super fund, using a limited recourse borrowing arrangement.Westpac, WBC1
510000319To purchase a commercial property in your existing self-managed super fund, using a limited recourse borrowing arrangement.CFS, Colonial First State1
610000328Would like to buy business real property using current SMSF and LRBA. More control and minimise tax for super investments. Flexibility and ease of administration of super. Like to buy a property in super. Maximise superannuation benefits.Aust super, Australian Super, Aus Super1
Sheet1
Cell Formulas
RangeFormula
D2:D6D2=--(COUNT(SEARCH(" "&FILTERXML("<p><c>"&SUBSTITUTE(C$2,",","</c><c>")&"</c></p>","//c")&","," "&SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(B2,"."," "),"/"," ")," ",", ")&","))>0)
 
Upvote 0
I'm not clear on exactly what you are trying to do. With that latest example, are you wanting to check

a) to see if the words in C2 exist in cell B2 and then check if the words in C3 exist in B3 etc

or

b) to see if any of the words in C2:C6 exist in B2 and then check if any of the words in C2:C6 exist in B3 etc

or

c) something else
 
Last edited:
Upvote 0
I'm not clear on exactly what you are trying to do. With that latest example, are you wanting to check

a) to see if the words in C2 exist in cell B2 and then check if the words in C3 exist in B3 etc

or

b) to see if any of the words in C2:C6 exist in B2 and then check if any of the words in C2:C6 exist in B3 etc

or

c) something else
Sorry for the confusion!! I actually want to be able to do both a and b above depending on the question and the range of words I may to look at.. So I would like:
1. A formula that just looks at words in one cell (i.e. your example of a)
2. A formula that looks ate words in a range of cells in a column (example b)
 
Upvote 0
Sorry for the confusion!! I actually want to be able to do both a and b above depending on the question and the range of words I may to look at.. So I would like:
1. A formula that just looks at words in one cell (i.e. your example of a)
2. A formula that looks ate words in a range of cells in a column (example b)
BTW the formulas can be in different cells.
 
Upvote 0
I think a change to vba is warranted, though there may still be some teething issues to work through. More on that later.

Here I am suggesting a user-defined function. The same function can be used to do both jobs as I understand them. To implement it ..
1. Right click the sheet name tab and choose "View Code".
2. In the Visual Basic window use the menu to Insert|Module
3. Copy and Paste the code below (you can use the icon at the top right of the code pane below) into the main right hand pane that opens at step 2.
4. Close the Visual Basic window.
5. Enter the formula* as shown in the screen shot below and copy down.
6. Your workbook will need to be saved as a macro-enabled workbook (*.xlsm)

VBA Code:
Function CheckWords(sGoals As String, rDic As Range) As Long
  Dim RX As Object
 
  Set RX = CreateObject("VBScript.RegExp")
  RX.IgnoreCase = True
  RX.Pattern = "\b(" & Replace(Replace(Application.TextJoin("|", 1, rDic), ", ", "|"), ",", "|") & ")\b"
  If RX.Test(sGoals) Then CheckWords = 1
End Function

* The formula in column D is the one-to-one check. So D2 formula checks to see if any words from C2 exist in B2, D3 formula checks to see if any words from C3 exist in B3 etc.
The formula in column E checks if any words in the whole of Dic1 exist in each cell in column B. So E2 formula checks all words in C2:C6 to see if any are in B2, E3 formula checks all words in C2:C6 to see if any are in B3 etc.

sobrien1234.xlsm
BCDE
1GoalsDic1
2Establish SMSF for residential property investment. LRBA/borrowing advice, with cash flow analysis. Rollover your existing super account/s into your SMSF. Keep the existing insurances in the super account/s being rolled over.LRBA, LBRA, Recourse11
3To purchase an investment property using your super by setting up a SMSF & utilising an LRBA.HUB24, HUB 2401
4Purchase a commercial property in your existing self-managed super fund, using a limited recourse borrowing arrangement.Westpac, WBC01
5To purchase a commercial property in your existing self-managed super fund, using a limited recourse borrowing arrangement.CFS, Colonial First State01
6Would like to buy business real property using current SMSF and LRBA. More control and minimise tax for super investments. Flexibility and ease of administration of super. Like to buy a property in super. Maximise superannuation benefits.Aust super, Australian Super, Aus Super01
Sheet2
Cell Formulas
RangeFormula
D2:D6D2=CheckWords(B2,C2)
E2:E6E2=CheckWords(B2,C$2:C$6)


Possible Issues:
  1. Punctuation may still cause an issue so keep an eye out for that. We should be able to handle such issues if they arise though.
  2. At the moment, this udf uses the TEXTJOIN function which is only available in Excel 365 and Excel 2019 so if this is to be used with other versions it will need modification, but that can be done.
  3. TEXTJOIN has a text length limit. You mentioned that Dic1 could get quite long. When used as in column E, the function joins all the Dic1 values into a string. For the sample above, that string is
    "LRBA, LBRA, Recourse|HUB24, HUB 24|Westpac, WBC|CFS, Colonial First State|Aust super, Australian Super, Aus Super"
    That string is just 113 characters long but if it were to exceed 32,767 characters then textjoin, and hence the udf, would fail. I think the size of Dic1 that you mentioned (150 companies with several names each should be okay but again keep an eye out if the list gets very long). Again, we can handle this differently if that text length does become a problem.
 
Upvote 0
Solution
I think a change to vba is warranted, though there may still be some teething issues to work through. More on that later.

Here I am suggesting a user-defined function. The same function can be used to do both jobs as I understand them. To implement it ..
1. Right click the sheet name tab and choose "View Code".
2. In the Visual Basic window use the menu to Insert|Module
3. Copy and Paste the code below (you can use the icon at the top right of the code pane below) into the main right hand pane that opens at step 2.
4. Close the Visual Basic window.
5. Enter the formula* as shown in the screen shot below and copy down.
6. Your workbook will need to be saved as a macro-enabled workbook (*.xlsm)

VBA Code:
Function CheckWords(sGoals As String, rDic As Range) As Long
  Dim RX As Object
 
  Set RX = CreateObject("VBScript.RegExp")
  RX.IgnoreCase = True
  RX.Pattern = "\b(" & Replace(Replace(Application.TextJoin("|", 1, rDic), ", ", "|"), ",", "|") & ")\b"
  If RX.Test(sGoals) Then CheckWords = 1
End Function

* The formula in column D is the one-to-one check. So D2 formula checks to see if any words from C2 exist in B2, D3 formula checks to see if any words from C3 exist in B3 etc.
The formula in column E checks if any words in the whole of Dic1 exist in each cell in column B. So E2 formula checks all words in C2:C6 to see if any are in B2, E3 formula checks all words in C2:C6 to see if any are in B3 etc.

sobrien1234.xlsm
BCDE
1GoalsDic1
2Establish SMSF for residential property investment. LRBA/borrowing advice, with cash flow analysis. Rollover your existing super account/s into your SMSF. Keep the existing insurances in the super account/s being rolled over.LRBA, LBRA, Recourse11
3To purchase an investment property using your super by setting up a SMSF & utilising an LRBA.HUB24, HUB 2401
4Purchase a commercial property in your existing self-managed super fund, using a limited recourse borrowing arrangement.Westpac, WBC01
5To purchase a commercial property in your existing self-managed super fund, using a limited recourse borrowing arrangement.CFS, Colonial First State01
6Would like to buy business real property using current SMSF and LRBA. More control and minimise tax for super investments. Flexibility and ease of administration of super. Like to buy a property in super. Maximise superannuation benefits.Aust super, Australian Super, Aus Super01
Sheet2
Cell Formulas
RangeFormula
D2:D6D2=CheckWords(B2,C2)
E2:E6E2=CheckWords(B2,C$2:C$6)


Possible Issues:
  1. Punctuation may still cause an issue so keep an eye out for that. We should be able to handle such issues if they arise though.
  2. At the moment, this udf uses the TEXTJOIN function which is only available in Excel 365 and Excel 2019 so if this is to be used with other versions it will need modification, but that can be done.
  3. TEXTJOIN has a text length limit. You mentioned that Dic1 could get quite long. When used as in column E, the function joins all the Dic1 values into a string. For the sample above, that string is
    "LRBA, LBRA, Recourse|HUB24, HUB 24|Westpac, WBC|CFS, Colonial First State|Aust super, Australian Super, Aus Super"
    That string is just 113 characters long but if it were to exceed 32,767 characters then textjoin, and hence the udf, would fail. I think the size of Dic1 that you mentioned (150 companies with several names each should be okay but again keep an eye out if the list gets very long). Again, we can handle this differently if that text length does become a problem.
This is awesome Peter! I really need to learn VBA. You are my new hero! I will do some testing and see how it goes. As you said there may be some punctuation issues ahead but we will see. Champion!
 
Upvote 0

Forum statistics

Threads
1,214,784
Messages
6,121,536
Members
449,037
Latest member
tmmotairi

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