Urgent need for help: Extracting data to a new spreadsheet based on one criteria but multiple matches

ReaRaeS

New Member
Joined
Mar 27, 2019
Messages
6
I have a daily sales spreadsheet that is added to daily. It is everything that is sold from 1/1 to 12/31 each year. It lists salespeople and items sold etc. I need to create a spreadsheet for each salesperson monthly to track their commissions for the month.
I have pulled that spreadsheet in to a second one with the columns I need by simply doing an = function and then delete the sales I do not need to calculate commissions on.

On my next spreadsheet (one for each salesperson) I am trying to pull their info to the new spreadsheet. The one I am pulling from has data from columns A - R. I only need the data from C - R with a few columns left out on the new spreadsheet, but I need all sales for that specific salesperson so I can't use Vlookup. I am trying this formula:
=IFERROR(INDEX('Daily Sales'!$C$2:$R$8150,SMALL(IF('Daily Sales'!$P$2:$P$8150=$B$1,ROW(INDIRECT("1:"&ROWS('Daily Sales'!$C$2:$C$8150)))),ROW(A1)),1),"")

Unfortunately, I am getting the first row of data in the spreadsheet that does not belong to the salesperson's number in B1 and in the following rows just blanks when the formula is copied down. I am guessing that my problem is somewhere in the Indirect formula but I have no idea what I should be using.

My original table (Tab: Daily Sales) has headers in row 1 and currently data in rows from 2 - 8150 and columns C - R. The salesperson's number is in column P. My new table (tab: 201 - Dave Brown) has the salesman # in B1 and the header info in row 4 with data to be in rows 5 - 500 or however are necessary to meet the sales for the month for each salesperson and columns A - J. The data in each of the columns is correct in that it came from the correct column on the original spreadsheet, just the wrong line(row).

Can someone please assist me in correcting this formula or help me with a new one so it grabs the correct rows.
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
it's actually better to post a small sample of the data and desired results.
 
Upvote 0
Example of Original Sheet

'Daily Sales'
C =1D =2E =3F =4G = 5H = 6I = 7J =8K = 9L= 10M = 11N = 12O =13P = 14Q =15R =16
1Invoice DateAreaClassCustomer #NameInvoice NumberItemQTYCityStateZipZip 3BranchSales Person Sales man Net sales value
23/1/2019DROPTR1007243St Agnes Medical Center49623651-850-7.75MM1 FresnoCA93720 937C203 KLM $ 79.00


<tbody>
</tbody>

Results on second sheet:

'201 - Dave Brown'
A = 1B = 4C = 5D = 6E = 7F = 8G=9H = 10I = 11J = 16
1Salesperson:201
2
3
4Invoice DateCustomer #NameInvoice NumberItemQTYCityStateZip Net sales value
53/4/20192500049 Green Valley Surgery Center496316 51-835-7.00MM1Las VegasNV8912075

<tbody>
</tbody>


Again, here is my formula in cell A5:
=IFERROR(INDEX('Daily Sales'!$C$2:$R$8023,SMALL(IF('Daily Sales'!$P$2:$P$8023=$B$1,ROW(INDIRECT("1:'Daily Sales'!"&ROWS('Daily Sales'!$C$2:$C$8023)))),ROW(A1)),1),"")

The results correspond to row 5 on the original spreadsheet and do not match the salesperson number in row P.
 
Upvote 0
I've amend your formula and data for testing, note that Formula in A5 (copy across and down) is a array formula.


Book1
CDEFGHIJKLMNOPQR
1Invoice DateAreaClassCustomer #NameInvoice NumberItemQTYCityStateZipZip 3BranchSales PersonSales manNet sales value
203/01/2019DROPTR1007243St Agnes Medical Center49623651-850-7.75MM1FresnoCA93720937C203KLM100
331/01/2019DROPTR1007243St Agnes Medical Center49623651-850-7.75MM2FresnoCA93720937C203KLM200
409/01/2019DROPTR1007243St Agnes Medical Center49623651-850-7.75MM3FresnoCA93720937C201KLM300
520/12/2018DROPTR1007243St Agnes Medical Center49623651-850-7.75MM4FresnoCA93720937C203KLM400
630/01/2019DROPTR1007243St Agnes Medical Center49623651-850-7.75MM5FresnoCA93720937C203KLM500
719/01/2019DROPTR1007243St Agnes Medical Center49623651-850-7.75MM6FresnoCA93720937C201KLM600
831/01/2019DROPTR1007243St Agnes Medical Center49623651-850-7.75MM7FresnoCA93720937C203KLM700
901/02/2019DROPTR1007243St Agnes Medical Center49623651-850-7.75MM8FresnoCA93720937C203KLM800
1001/01/2019DROPTR1007243St Agnes Medical Center49623651-850-7.75MM9FresnoCA93720937C201KLM900
1120/01/2019DROPTR1007243St Agnes Medical Center49623651-850-7.75MM10FresnoCA93720937C203KLM1000
Daily Sales



Book1
ABCDEFGHIJ
1Salesperson:203
2
3
4Invoice DateCustomer #NameInvoice NumberItemQTYCityStateZipNet sales value
503/01/20191007243St Agnes Medical Center49623651-850-7.75MM1FresnoCA93720100
631/01/20191007243St Agnes Medical Center49623651-850-7.75MM2FresnoCA93720200
720/12/20181007243St Agnes Medical Center49623651-850-7.75MM4FresnoCA93720400
201 - Dave Brown
Cell Formulas
RangeFormula
A5{=IFERROR(INDEX('Daily Sales'!$C$2:$R$8150,SMALL(IF('Daily Sales'!$P$2:$P$8150=$B$1,ROW(INDIRECT("1:"&ROWS('Daily Sales'!$C$2:$C$8150)))),ROW(A1)),MATCH(A$4,'Daily Sales'!$C$1:$R$1,0)),"")}
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Upvote 0

Forum statistics

Threads
1,216,114
Messages
6,128,913
Members
449,478
Latest member
Davenil

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