VBA alternative to Index/Match/CountaA

Charmwah

Board Regular
Joined
Jan 23, 2017
Messages
64
Hi all

I'm trying to find a way to create an alternative to a longwinded INDEX/MATCH/COUNTA formula in VBA, in the hope that the VBA simplifies the process, or at least has a more straightforward way of achieving the same end. The requirement of the formula is to lookup all entries in a database that match the chosen lookup value (from a drop down list) and then return the customer with the matching entry, with all matching entries being listed. At present the results are displayed within the worksheet in descending rows. But i'm thinking that this whole process would be just as easy to set up in a UserForm.

The database looks like the below, with the exception that the 'product group' cells are merged (so only one of each type):

[TABLE="width: 500"]
<tbody>[TR]
[TD][/TD]
[TD]Product Group A[/TD]
[TD]Product Group A[/TD]
[TD]Product Group A[/TD]
[TD]Product Group B[/TD]
[TD]Product Group B[/TD]
[TD]Product Group B[/TD]
[TD]Product Group C[/TD]
[TD]Product Group C[/TD]
[TD]Product Group C[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]Variant A1[/TD]
[TD]Variant A2[/TD]
[TD]Variant A3[/TD]
[TD]Variant B1[/TD]
[TD]Variant B2[/TD]
[TD]Variant B3[/TD]
[TD]Variant C1[/TD]
[TD]Variant C2[/TD]
[TD]Variant C3[/TD]
[/TR]
[TR]
[TD]Customer A[/TD]
[TD]Yes[/TD]
[TD]Yes[/TD]
[TD]Yes[/TD]
[TD][/TD]
[TD]Yes[/TD]
[TD][/TD]
[TD]Yes[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Customer B[/TD]
[TD][/TD]
[TD]Yes[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]Yes[/TD]
[TD][/TD]
[TD]Yes[/TD]
[TD]Yes[/TD]
[/TR]
[TR]
[TD]Customer C[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]Yes[/TD]
[TD][/TD]
[TD]Yes[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Customer D[/TD]
[TD]Yes[/TD]
[TD]Yes[/TD]
[TD]Yes[/TD]
[TD]Yes[/TD]
[TD][/TD]
[TD]Yes[/TD]
[TD][/TD]
[TD]Yes[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]


My formula is as follows:

=IFERROR(OFFSET(OtherDB!$A$3,SMALL(IF(OFFSET(OtherDB!$A$3,1,INDEX(OtherList!$A$2:$A$161,MATCH($C$3,ProdListOther,0)),COUNTA(OtherDB!$A$4:$A$13),1)<>"",ROW(OtherDB!$A$4:$A$13),""),ROW()-ROW($F$3))-3,0),"")

'OtherDB!' is the database, 'OtherList!' is the crib list the makes the search work.

Can anybody point me in the right direction at all in terms of a workable VBA solution?

Thanks in advance!
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes

Forum statistics

Threads
1,223,958
Messages
6,175,643
Members
452,663
Latest member
MEMEH

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