VBA or Excel Formulas

Eng mona
NewLounger
Posts: 20
Joined: 13 Feb 2024, 09:41

VBA or Excel Formulas

Post by Eng mona »

Hi all,

Is there a way in Excel, using formulas or VBA, to look for certain text in a string in Column A and, if found, to copy/paste it into other columns?
For example:
Cell A1 = Can share; Word List; Computer; 10 min/hr
The formula should put “Can share” in C1 , “Computer “in D1 , “10 min/hr” in B1 and so on.

Another example with multiple texts to go one column as in A10 =Technology Software; Printing Needs; Bring items; Cannot share; Nursing extra time (20 mins 1st yr, 10 mins 2nd yr, 5 mins 3rd yr, 0 mins NURS703); Flexibility to move; Morning; 48hrs
The formula this time should put “Technology Software” in D1 , “Printing Needs , Bring items, Flexibility to move” in H1 ,” Cannot share” in C1, : Nursing extra time (20 mins 1st yr, 10 mins 2nd yr, 5 mins 3rd yr, 0 mins NURS703)” in B1 , and “Morning , 48hrs” in F1.
So when there are multiple strings to be copied ina cell, they should be separated by “,”

A1 list in first sheet in the attached spreadsheet has different texts, and they should be copied into the respective columns in the first sheet as per the mapping table in the second sheet in the attached spreadsheet.

Many thanks in advance for any help 😊
You do not have the required permissions to view the files attached to this post.

User avatar
HansV
Administrator
Posts: 78488
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: VBA or Excel Formulas

Post by HansV »

See the attached version.

data (6).xlsx
You do not have the required permissions to view the files attached to this post.
Best wishes,
Hans

User avatar
p45cal
2StarLounger
Posts: 149
Joined: 11 Jun 2012, 20:37

Re: VBA or Excel Formulas

Post by p45cal »

Another. If the data in column A changes, right-click somewhere in the table at cell C1 and choose Refresh to update the results.
You do not have the required permissions to view the files attached to this post.

Eng mona
NewLounger
Posts: 20
Joined: 13 Feb 2024, 09:41

Re: VBA or Excel Formulas

Post by Eng mona »

Hi @Hans V and P45cal,

Many thanks for your help.

I was able to test the output populated by both the formula and the query and both work perfectly. You are champions :hairout:

Thanks heaps.