filtering data from monthly report

mediumrare

New Member
Joined
Apr 7, 2021
Messages
31
Office Version
  1. 365
Platform
  1. Windows
Hello!
Each month I pull a sales report for a certain manufacturer. I would like to have a template sheet that searches and filters the raw data based on another sheet. So, three sheets total. The template, the reference, and the raw data.

I don't know the best way to show this, so I'm including three separate Mini Sheets. I feel embarrassed for asking, knowing that it's probably just a modification of things I've already been shown here. Nevertheless... here goes...

The raw data ("data") is in the same arrangement every month. Not all data is relevant for my report. I've tried to match the column headers to match every sheet for the sake of clarity.
_template_b0.1 deID.xlsx
ABCDEFGHIJKLMNOPQ
1end-user-numberend-userinv-numbervendor-SKUproduct-descVendorUOMinv-dateqtyproduct-priceinv-extST-nameST-add1addressST-STST-ZIPLast PO Cost
29174end-user9174P164041vendorproduct001desc001vendorABCCS05/04/21245.7591.50texttexttexttexttext27.7300
39174end-user9174P164041vendorproduct002desc002vendorABCCS05/04/21229.0058.00texttexttexttexttext18.3700
49174end-user9174461312vendorproduct002desc002vendorABCCS05/10/21423.3293.28texttexttexttexttext18.3700
59174end-user9174P164323vendorproduct003desc003vendorABCCS05/10/21126.4026.40texttexttexttexttext14.5500
69174end-user9174P164134vendorproduct004desc004vendorABCCS05/06/21185.8885.88texttexttexttexttext52.0500
79174end-user9174462228vendorproduct002desc002vendorABCCS05/18/21629.00174.00texttexttexttexttext18.3700
89174end-user9174462344vendorproduct002desc002vendorABCCS05/19/21527.50137.50texttexttexttexttext18.3700
99174end-user9174462228vendorproduct005desc005vendorABCCS05/18/211222.64271.68texttexttexttexttext14.1500
109174end-user9174460581vendorproduct003desc003vendorABCCS05/03/21822.15177.20texttexttexttexttext14.5500
119174end-user9174462228vendorproduct003desc003vendorABCCS05/18/21826.40211.20texttexttexttexttext14.5500
129174end-user9174462344vendorproduct003desc003vendorABCCS05/19/211022.15221.50texttexttexttexttext14.5500
139174end-user9174461174vendorproduct001desc001vendorABCCS05/06/21245.7591.50texttexttexttexttext27.7300
149174end-user9174458126vendorproduct002desc002vendorABCCS03/29/21529.00145.00texttexttexttexttext18.3700
159174end-user9174458648vendorproduct002desc002vendorABCCS04/05/21529.00145.00texttexttexttexttext18.3700
169174end-user9174459775vendorproduct002desc002vendorABCCS04/19/21429.00116.00texttexttexttexttext18.3700
179174end-user9174460336vendorproduct002desc002vendorABCCS04/27/21429.00116.00texttexttexttexttext18.3700
189174end-user9174461488vendorproduct002desc002vendorABCCS05/14/21829.00232.00texttexttexttexttext18.3700
199174end-user9174462611vendorproduct002desc002vendorABCCS05/21/21229.0058.00texttexttexttexttext18.3700
209174end-user9174463145vendorproduct002desc002vendorABCCS05/28/21429.00116.00texttexttexttexttext18.3700
219174end-user9174459772vendorproduct001desc001vendorABCCS04/19/211033.53335.30texttexttexttexttext27.7300
229174end-user9174459777vendorproduct001desc001vendorABCCS04/19/211533.53502.95texttexttexttexttext27.7300
239174end-user9174459778vendorproduct001desc001vendorABCCS04/19/211033.53335.30texttexttexttexttext27.7300
249174end-user9174460160vendorproduct001desc001vendorABCCS04/22/21333.53100.59texttexttexttexttext27.7300
259174end-user9174461573vendorproduct001desc001vendorABCCS05/12/21133.5333.53texttexttexttexttext27.7300
261325end-user1325459770vendorproduct002desc002vendorABCCS04/19/214024.50980.00texttexttexttexttext18.3700
data


I'd like to take the raw data and check it against this sheet ("contracts"). It would have the applicable, relevant data that I'm trying to extract. The relevant data needs to be from the same end-user and vendor-SKU. So if the end user does not match, it is irrelevant. If the end user matches but the vendor-SKU does not, it also is irrelevant.
_template_b0.1 deID.xlsx
ABCDEFGHI
1contract-numberend-user-numberend-useraddressvendor-SKU contract-price contract-qtyeff-dateexp-date
203809174end-user9174end-user9174 addressvendorprod001$ 35.0050003/01/2102/28/22
303809174end-user9174end-user9174 addressvendorprod002$ 35.0050003/01/2102/28/22
403809174end-user9174end-user9174 addressvendorprod003$ 26.501,00003/01/2102/28/22
503809174end-user9174end-user9174 addressvendorprod004$ 23.0050003/01/2102/28/22
603809174end-user9174end-user9174 addressvendorprod005$ 47.0010003/01/2102/28/22
703809174end-user9174end-user9174 addressvendorprod006$ 31.952,50003/01/2102/28/22
803809174end-user9174end-user9174 addressvendorprod007$ 23.571,50003/01/2102/28/22
903809174end-user9174end-user9174 addressvendorprod008$ 28.501,50003/01/2102/28/22
1003809174end-user9174end-user9174 addressvendorprod009$ 32.5025003/01/2102/28/22
1103809174end-user9174end-user9174 addressvendorprod010$ 39.5050003/01/2102/28/22
1203809174end-user9174end-user9174 addressvendorprod011$ 37.752,00003/01/2102/28/22
1303809174end-user9174end-user9174 addressvendorprod012$ 39.7515003/01/2102/28/22
1403809174end-user9174end-user9174 addressvendorprod013$ 29.6410003/01/2102/28/22
1503809174end-user9174end-user9174 addressvendorprod014$ 30.1810003/01/2102/28/22
1603809174end-user9174end-user9174 addressvendorprod015$ 37.5310003/01/2102/28/22
1703809174end-user9174end-user9174 addressvendorprod016$ 56.6810003/01/2102/28/22
1803809174end-user9174end-user9174 addressvendorprod017$ 40.3910003/01/2102/28/22
1903809174end-user9174end-user9174 addressvendorprod018$ 54.4710003/01/2102/28/22
2003809174end-user9174end-user9174 addressvendorprod019$ 20.611,50003/01/2102/28/22
2103809174end-user9174end-user9174 addressvendorprod020$ 32.5050003/01/2102/28/22
2203809174end-user9174end-user9174 addressvendorprod021$ 36.5025003/01/2102/28/22
2303809174end-user9174end-user9174 addressvendorprod022$ 36.0050003/01/2102/28/22
2403809174end-user9174end-user9174 addressvendorprod023$ 20.0050003/01/2102/28/22
2503809174end-user9174end-user9174 addressvendorprod024$ 43.5025003/01/2102/28/22
2619851325end-user1325end-user1325 addressvendorprod025$ 33.545004/01/2109/30/21
2719851325end-user1325end-user1325 addressvendorprod026$ 29.415004/01/2109/30/21
2819851325end-user1325end-user1325 addressvendorprod011$ 37.755004/01/2109/30/21
2955738915end-user8915end-user8915 addressvendorprod027$ 30.5040009/01/2108/31/22
3055738915end-user8915end-user8915 addressvendorprod028$ 27.5030009/01/2108/31/22
contracts


If the end user matches and the vendor-SKU matches, then the Template should be filled.
_template_b0.1 deID.xlsx
ABCDEFGHIJK
1contract-numberend-useraddressinv-dateinv-numbervendor-SKUtotal-qtyuom total-rebate inv-price contract-price
2$ -
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
template
Cell Formulas
RangeFormula
I2I2=(J2-K2)*G2


I hope I am being clear and making sense for what I am trying to achieve.
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
its a great task for power query.

I could try helping out. but first
"So if the end user does not match, it is irrelevant. If the end user matches but the vendor-SKU does not, it also is irrelevant."

So ifI get correctly then:

those field names from both sheet must contain the same details
data:End user, vendor-SKU
contract sheet:End user, vendor-SKU
 
Upvote 0
its a great task for power query.

I could try helping out. but first


So ifI get correctly then:

those field names from both sheet must contain the same details
data:End user, vendor-SKU
contract sheet:End user, vendor-SKU

I have not used Power Query before but am open to it. Would I need to learn or do anything first in order to do this?

The sheets would most likely contain the same details, if you mean the same spelling, etc. Unless I needed to create yet another sheet that says, essentially, "If it reads this, then it actually means this."
 
Upvote 0
@mediumrare
no, its your description is kinda like double negative, instead of simple comparison.
Thats why Im asking which columns must contain the same values to compare.

If I'm getting this right, it would be simple job of loading both tables to power query. doing either:
left-outer join (all from 1st table matching from the second)
inner join (only matching records from both tables) (I might got the join name wrong here)

its all doable without any Mcode, it's simple click-to-do - all stuff is on the ribbon in the editor if I'm getting this right.

Also, a bit different way would be to use filter functin.
 
Upvote 0
So if the end user does not match, it is irrelevant. If the end user matches but the vendor-SKU does not, it also is irrelevant.

those field names from both sheet must contain the same details
data:End user, vendor-SKU
contract sheet:End user, vendor-SKU

The data I want is for all end users with a contract for certain products at a certain price. Each contract can include multiple products. Since multiple contracts might have the same product, I would need to make sure that the product and its correct price as stated on the contract follows the contract end user--not the product.

I used "end-user" and "vendor-SKU" on each sheet to reflect that association. Those columns must contain the same values to compare.

Is that clearer?

@mediumrare
no, its your description is kinda like double negative, instead of simple comparison.
Thats why Im asking which columns must contain the same values to compare.

If I'm getting this right, it would be simple job of loading both tables to power query. doing either:
left-outer join (all from 1st table matching from the second)
inner join (only matching records from both tables) (I might got the join name wrong here)

its all doable without any Mcode, it's simple click-to-do - all stuff is on the ribbon in the editor if I'm getting this right.

Also, a bit different way would be to use filter functin.

Okay, so I'll need to try this out and see if I can follow what you're suggesting.
 
Upvote 0
ok, ur sample data is wrong
in data: vendorproduct001
in contract: vendorprod001

they are not the same for PQ.
ill manually change prod to product to fit the merge.

ill post the solution, but you must find out if this is normal or its just hastly prepared data.


//EDIT

Here you go:

Let me know if any of those joins suits ur needs.
 
Upvote 0
ok, ur sample data is wrong
in data: vendorproduct001
in contract: vendorprod001

they are not the same for PQ.
ill manually change prod to product to fit the merge.

ill post the solution, but you must find out if this is normal or its just hastly prepared data.

That was a mistake on my part. I was (as you put it, hastily) de-identifying the data in order to post it publicly.
 
Upvote 0
no worries.
I shared a file so do please download and let me know if that is it.

the process is simple:
ALT, A, PT - load both tables to PQ. (u must close and load first one, then do other one.

open the bar at right side.
ALT, H, I, down arrow, enter to open merging menu as new merge.
choose tables (order is important for the merge type. (i chose data first, contracts second.)
choose columns and pay close attention to numbers (there should be small grey number 1 and 2. the order of selecting columns MUST BE THE SAME for both tables.
done.
now go to far right, click the small button top right corner on the column where I'll see Table green text (don't click the text)
and choose the columns you wish to see in the comparison.

I left all columns on purpose since I did not know ur exact needs, but irrelevant columns may be deleted in PQ (but they will stay in source tables)
Then simply load the query and ur done.
 
Upvote 0
no worries.
I shared a file so do please download and let me know if that is it.

the process is simple:
ALT, A, PT - load both tables to PQ. (u must close and load first one, then do other one.

open the bar at right side.
ALT, H, I, down arrow, enter to open merging menu as new merge.
choose tables (order is important for the merge type. (i chose data first, contracts second.)
choose columns and pay close attention to numbers (there should be small grey number 1 and 2. the order of selecting columns MUST BE THE SAME for both tables.
done.
now go to far right, click the small button top right corner on the column where I'll see Table green text (don't click the text)
and choose the columns you wish to see in the comparison.

I left all columns on purpose since I did not know ur exact needs, but irrelevant columns may be deleted in PQ (but they will stay in source tables)
Then simply load the query and ur done.
I'll give this a try in the morning!
 
Upvote 0

Forum statistics

Threads
1,224,824
Messages
6,181,187
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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