Translate Excel formula into a VBA working code

jremmske

New Member
Joined
Dec 7, 2016
Messages
1
I have limited experience with vba. I know how to create variables and print out a few things, but what I am looking to do is slightly more complicated than that. I was able to create an excel formula that looks at a list and returns the value for a corresponding row, column by using the index and small functions. I used these two web pages for help:

Vlookup Multiple Values - Return MULTIPLE corresponding values for ONE Lookup Value

https://www.youtube.com/watch?v=wclmIcTsbtg

This is the formula I created:
=IF($P13="Other",INDEX($F$13:$P$2262,SMALL(IF($F$13:$F$2262=$Q13,ROW($F$13:$F$2262)-12),COLUMNS($S13:S13)),5),
FALSE)

I can drag this formula across columns and end up with a complete list of all the Others I need. The total number of items that match F:F to Q are not always the same. Sometimes there is 1 instance its true, sometimes there is 5 times, in theory it could be as many as possible. Lastly, I have a Concatenate formula that takes all this data and sticks it together into one cell.

I was wondering if its possible to create a macro that runs the formula in a loop for the number of times F:F is Q, then posts those values into ONE cell with a comma separator. If anybody can do this, that would be awesome. If this doesn't make sense I will try to explain it as best as I can. Here is an example of what I would like though: This is not my actual data, but everything passed through is a String. The List of Managers is what I would like.

CompanyManagerManager RedefineList of Managers
A
TimTimFalse
AOmegaOtherOmega
BBillBillFalse
BPhiOtherPhi, Zeta
BZetaOtherPhi, Zeta

<tbody>
</tbody>
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".

Forum statistics

Threads
1,215,256
Messages
6,123,915
Members
449,132
Latest member
Rosie14

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