In the following example, I have a range of values in the column E. data in the column A. In the columns B and C I have entered formulas (arrived by working stepwise on several columns and then combining it). Everything works well and extracts first word from A into column B only if it is part of the range in the column E. And it leaves the rest in the column C.
Is it possible to have a vba which can do the same thing? Thank you.
Is it possible to have a vba which can do the same thing? Thank you.
rscripto11.xlsm | |||||||
---|---|---|---|---|---|---|---|
A | B | C | D | E | |||
42 | GM #1 | GM #1 | One | ||||
43 | Dodge #4 | Dodge #4 | Two | ||||
44 | Ford #2 | Ford #2 | Three | ||||
45 | Jeep #3 | Jeep #3 | Four | ||||
46 | One Dodge | One | Dodge | Five | |||
47 | Two Dodge | Two | Dodge | ||||
48 | Two Jeep | Two | Jeep | ||||
49 | One Dodge | One | Dodge | ||||
50 | One Jeep | One | Jeep | ||||
51 | Two Jeep | Two | Jeep | ||||
Sheet6 |
Cell Formulas | ||
---|---|---|
Range | Formula | |
B42:B51 | B42 | =IF((COUNTIF($E$42:$E$51,IFERROR(LEFT(A42, FIND(" ", A42)-1), A42))=1),IFERROR(LEFT(A42, FIND(" ", A42)-1), A42),"") |
C42:C51 | C42 | =IF((COUNTIF($E$42:$E$51,IFERROR(LEFT(A42, FIND(" ", A42)-1), A42))=1),IF((ISERROR(SUBSTITUTE(A42,LEFT(A42,FIND(" ",A42)),""))=FALSE),SUBSTITUTE(A42,LEFT(A42,FIND(" ",A42)),""),""),A42) |