Convert Formula to VBA

Sufiyan97

Well-known Member
Joined
Apr 12, 2019
Messages
1,614
Office Version
  1. 365
  2. 2013
Platform
  1. Windows
I am using below formula which works Perfectly for Fatching Vendor Name based on partial text match
It searches text from Cells G2 to J1000
finds it in column A and Puts Vendor name and account from Column E to F

Is there a way to convert this formula into VBA so when I run the code it does the same job as formula

Book5
ABCDEFGHIJ
1DescriptionVendor NameAccountVendor NameAccountDescription1Description2Description3Description4
2MERCURY INS DES:PAYMENT ID:1000514717-9306 INDN:JENSEN, DAVID CO ID:GXXXXXXXXX PPDMercury InsuranceInsurance Expense7-11Auto and Truck Expenses7-ELEVEN7ELEVEN7ELE#N/A
3ALLSTATE INS CO DES:INS PREM ID:000000981945736 INDN:JENSEN CO ID:1360719665 PPDAllstate InsuranceInsurance ExpenseAdvance AutoOther Job Related CostsADVANCE AUTO P#N/A#N/A#N/A
4CHECKCARD 1230 OLIVE GARDEN 0021 ORLANDO FL 55310208365091727000057 CKCD 5812 XXXXXXXXXXXX3705 XXXX XXXX XXXX 3705  Agilis Linxup#N/AAGILIS#N/A#N/A#N/A
5CHECKCARD 1230 OLIVE GARDEN 000 ORLANDO FL 15410198365140493695099 CKCD 5812 XXXXXXXXXXXX3705 XXXX XXXX XXXX 3705  Allstate InsuranceInsurance ExpenseALLSTATE#N/A#N/A#N/A
6CHECKCARD 0101 DOMINO'S 9450 407-852-9595 FL 05436849002500098516305 CKCD 5814 XXXXXXXXXXXX3705 XXXX XXXX XXXX 3705Domino'sOwner's DrawAmazonOwner's DrawAMAZON.COMAMAZON DIGITAL#N/A#N/A
7OVERDRAFT ITEM FEE FOR ACTIVITY OF 01-02  Amtrust#N/AAMTRUST#N/A#N/A#N/A
8CHECKCARD 0102 AGILIS LINXUP MOT 877-732-4980 MO 55432869002200773574177 CKCD 5734 XXXXXXXXXXXX3705 XXXX XXXX XXXX 3705Agilis Linxup Annual Pass FlexOwner's DrawANNUAL PASS FLEX#N/A#N/A#N/A
9OVERDRAFT ITEM FEE FOR ACTIVITY OF 01-03  Applebee’sOwner's DrawAPPLEBEES#N/A#N/A#N/A
10SNAP FINANCE DES:PAYMENT ID:PXXXXXXXXX INDN:David Jensen CO ID:1455176354 PPDSnap FinanceAsk My AccountantAuto Air & VacuumAuto and Truck ExpensesAUTO AIR & VACUUM#N/A#N/A#N/A
11CHECKCARD 0104 MCDONALD'S F38 AUBURNDALE FL CKCD 5814 XXXXXXXXXXXX3705 XXXX XXXX XXXX 3705McDonaldsOwner's DrawaynaxOther Job Related CostsAYNAX#N/A#N/A#N/A
12BKOFAMERICA ATM 01/04 #000007878 WITHDRWL HAINES CITY HAINES CITY FL  Beefy KingOwner's DrawBEEFY KING #N/A#N/A#N/A
13DOLLAR GENERAL 01/04 #000044661 PURCHASE 49571 HIGHWAY 27 DAVENPORT FLDollar GeneralOwner's DrawBPOwner's DrawBP##N/A#N/A#N/A
14Bridgecrest DES:DT RETAIL ID:7178605 INDN:David Jensen CO ID:2860677984 PPDBridgecrest Bridgecrest#N/ABridgecrest#N/A#N/A#N/A
15CHECKCARD 0104 OCBCC SOLID WASTE ORLANDO FL 55480779004200033100227 CKCD 4900 XXXXXXXXXXXX3705 XXXX XXXX XXXX 3705Solid WasteUtilitiesBurger KingOwner's DrawBURGER KING#N/A#N/A#N/A
16CHECKCARD 0104 WAWA 5207 000 ORLANDO FL 15410199004637000434115 CKCD 5542 XXXXXXXXXXXX3705 XXXX XXXX XXXX 3705WawaAuto and Truck ExpensesCardtronicsOwner's DrawCardtronics#N/A#N/A#N/A
Sheet1
Cell Formulas
RangeFormula
B2:B16B2=IFERROR(INDEX($E$2:$E$70,AGGREGATE(15,6,ROW($E$2:$E$70)-ROW($E$2)+1/ISNUMBER(SEARCH($G$2:$J$70,A2)),1)),"")
C2:C16C2=IFERROR(INDEX($F$2:$F$70,AGGREGATE(15,6,ROW($E$2:$E$70)-ROW($E$2)+1/ISNUMBER(SEARCH($G$2:$J$70,A2)),1)),"")
 
Thank you very mcuh Alex

That works perfectly. (y)

Thank you for your time, patience and effort.


Thanks @aaewalsh for trying and you time.
 
Upvote 0

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.

Forum statistics

Threads
1,224,820
Messages
6,181,155
Members
453,021
Latest member
Justyna P

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