VBA to extract data from Excel database sheet based on cell value on activesheet

Hunter_001

New Member
Joined
Apr 21, 2022
Messages
2
Office Version
  1. 365
Platform
  1. Windows
Hi All,

I am trying to create a quote and have run into a snag.
I have a product database on a separate sheet (ProductDB) and have to extract the data from there to the quote (Form) based on a drop down menu in the quote line (cell value).
(I posted the DB sheet below and the output sheet (Form) with an arrow to better explain what it should look like (ideally)).
I also need to disable/delete the dropdown menu in Col C if there is data in Col D.

I've tried everything I can think of, but don't want to put complicated formulas in the cells.

The best I came up with is to use Offset in cell Form!D19 from a different database (PACKAGEDB) where the package name and items are assembled using:
=CONCATENATE("Build-your-own-package - SMALL PACKAGES & BABY1 PACKAGES",CHAR(10),"Item 1",CHAR(10),"Item 2",CHAR(10),"Item 3",CHAR(10),"Item 4"

In green is what I managed with:
=IF(LEN(VLOOKUP(C19,PACKAGEDB!$A$2:$F$24,2,FALSE)>0),OFFSET(PACKAGEDB!A2,0,1,1,7),"")

Basically what I want to do is to use the dropdown in C19 and cycle through the ProductDB until all matches from ProductDB based on ProductDB!D:D (PLAN) cell content are extracted to the quote sheet.
The "item code" can display for the zero value items as well if it cannot be avoided. Some products from the ProductDB will be applicable to more than one plan.
I also want to override the dropdown menus in C

If anyone could assist me here with a VBA/formula to do this, I would be forever grateful.

P.s. There are a bunch of other macros and VBAs on the sheet to reset areas, lock/unlock, insert rows etc., but this one I cannot crack.
With OFFSET I cannot get the items to display in separate rows as INDEX, FIND, MATCH, COUNTIF & LEN combinations etc. can only give me the number of lines - not specific lines that contain the data.

File is available - not sure if I can place a link to a Dropbox? I need to redo the "reset form" sheet in correct format/columns once I have figured out the issue at hand.

TIA

1650574858829.png
1650575068374.png
 

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.

Forum statistics

Threads
1,224,818
Messages
6,181,151
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