How do I translate Index/Match function to VBA code?

The_Wanderer

New Member
Joined
Apr 13, 2022
Messages
10
Office Version
  1. 2016
Platform
  1. Windows
Hi, I need some help here. How would I translate this to a vba code?

=INDEX(P:P,MATCH "Equity Funds*",H:H,0)) / INDEXJ:J,MATCH("Equity Funds*",H:H,0))


I don't know how to translate this, your help would be appreciated, thanks.
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
without testing (had no data)
=application.index(columns("P"), application.match("Equity Funds*",columns("H"),0))/application.index(columns("J"), application.match("Equity Funds*",columns("H"),0))
 
Upvote 0
Hi BSALV, thank you for the quick response. It appears it didn't do anything. My apologies, I should elaborate more.

I'm trying to divide column P and J (P/J) where text "Equity Funds" exist. For every time the text exist in col H, divide the col P and J into col K. Here is what I did down below:

Range ("K8:K8").Formula = "P8/J8"
With Cells.Find ("Equity Funds")
With Cells(.row, "K")
.font.bold = true
end with
end with

As you can see this only works if I have to add in the formula P8/J8 to be specific. The data is always changing so it might not be P8/J8 everytime. Thanks.
 
Upvote 0
Disregard msg above. I got it to work. I used the below:

Test = =application.index(columns("P"), application.match("Equity Funds*",columns("H"),0))/application.index(columns("J"), application.match("Equity Funds*",columns("H"),0))

With Cells.Find ("Equity Funds")
With Cells(.row, "K")
.value = test
.font.bold = true
end with
end with

Thanks so much for your assistance.
 
Upvote 0

Forum statistics

Threads
1,215,514
Messages
6,125,265
Members
449,219
Latest member
daynle

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