I am trying to limit some records that are tied to a table in excel

I have a table or spreadsheet called SF-Opportunites that has 318 opportunities in it. I want to limit the records returned in the other two tables by those OpportunityID's back to only the Accounts and Contacts those 318 records are associated with.  How do I link it to two other tables SF_Accounts & SF_Tasks that have Key Relational Fields in them in order to get only the accounts and contacts associated with them (the 318 Opportunities) and nothing else? The dataset is too large so I was able to get a good sampling of random data from the 318 opportunities that will work for my proof of concept project.

Table SF_Opportunities has
Field = AccountID
Field = ContactID
Field = OpportunityID

Table SF_Accounts has
Field = AccountID
Field = ContactID

Table SF_Tasks has
Field = ContactID
Field = OpportunityID
Field = TaskID

Once all the Accounts and Tasks that are associated with those 318 Opportunities are linked. I need all the excess records to go away...In other words, if they disappear then my overall size of the table or file is smaller. (Consequently, I am trying to get to smaller file that Salesforce.com can accept imported into their developer edition...5MB)

I tried linking it to Excel and Access but kept getting the same number of records returned. Not sure how to get this done. Its either Operator error or something is wrong with my thinking? What should I be able to do in order to limit the records to just the accounts and therefore tasks if I just pull the records that match the OpportunityID's in the one table matching them to the other two tables with the Key relational fields listed?
RUA Volunteer2?Tableau Trainer & Consultant Sales Exec.Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

abbas abdullaCommented:

Please check the attached solution, it's done using Power Query. The output are shown in SF_AC_Filtered & SF_TaskFiltered Sheets.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
RUA Volunteer2?Tableau Trainer & Consultant Sales Exec.Author Commented:
Thank you very much sir
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Office

From novice to tech pro — start learning today.