How do i Combine two tables which change in rows depending on the input of the user using VBA in excel?

Nicholas Agius

New Member
Joined
Apr 13, 2014
Messages
9
Hello,


I am new to VBA in excel and i hope i can find some help here :)
Ok so before i start with the problem i have a macro which takes the results generated and puts them into a table and filters the data so that zeros does not show and arranges the table from largest to smallest.
Now i have a problem where i need to select the power, fuel oil consumption, weight and area from one table and the other power, fuel oil consumption, weight and area from the other table and combine them together so that i can have all possible combinations of the data, but i don't want the zeros to show in the combinations. frankly speaking i don't know where to even begin and i was hoping i can get some help. i need the combined data to show on a separate sheet.
The data of table 1 varies with rows as shown:
Ranking%20Table%201.png

The Data of Table 2 varies with rows as shown:
Ranking%20Table%202.png

I would like to achieve a result like this in the following columns and rows without having to input them manually:
Possible%20outcome.png



If somebody can help me achieve this i would be very much grateful :)
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
hi

I don't see any images of the data. So my comments may be off the mark.

It sounds like the whole exercise can be done without VBA using query table, or maybe two. A query table can put results in a table, filtered without zeros and arranged from largest to smallest. A query table can pull selected fields from two tables and cross-join them to give all possible combinations. Excel help & google will find examples. For specific help please give sample data - there will be a sticky thread at the top of the forum or one of the how to post places - & advice of your Excel version.

regards
 
Upvote 0

Forum statistics

Threads
1,223,236
Messages
6,170,912
Members
452,366
Latest member
TePunaBloke

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