Pulling data from an inconsistent sheet into a consistent table.

Coien

New Member
Joined
Mar 25, 2023
Messages
1
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
I have a report with information that I want to pull into a table. The report lists names of sales employees, and below that it lists how many units of each product they've sold. If they have not sold a product however, the product name will not appear on the report under the employee's name. For example, if Employee A has sold at least one of each product, all products will populate beneath their name with the quantity sold next to it. If Employee B has sold every product except one, then that one product will not appear on the report. The products are always listed in the same order, and if the first product in the list has not been sold by the employee, the entire row will be missing from the sheet. However, if the employee has only sold the first product on the list and the last product on the list, then there will be entirely blank rows on the sheet for each product the employee did not sell.
 

Attachments

  • Screen Shot 2023-03-25 at 6.30.16 PM.png
    Screen Shot 2023-03-25 at 6.30.16 PM.png
    48.7 KB · Views: 7

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
So lets suppose you have on Sheet1 a report like this:
Cartel1
ABC
1Inconsistent List
2
3Employee1
4AA1
5BB2
6CC3
7DD4
8
9Total Units10
10
11
12
13Employee2
14
15BB22
16CC23
17
18
19Total Units45
20
21Employee3
22
23
24
25Total Units0
Sheet1


Now the basic rule is "sh** in - sh** out"
But f you want to dare your fate then go to Sheet2; create in column A the list with the employee name followed by the full list of product (the yellow area in the following XL2BB minisheet), STARTING from Row2 (leave A1 empty)
Now set in B3 the following formula:
Excel Formula:
=LET(EMPL,INDIRECT("A"&1+MAX(IF($A$1:A1="",ROW($A$1:A1),""))),myBLKs,MATCH(EMPL,Sheet1!$A$1:$A$100,0),myBLKe,MATCH("Total Units",INDIRECT("Sheet1!A"&myBLKs&":A100"),0),mayBE,IFERROR(VLOOKUP(A3,INDIRECT("Sheet1!A"&myBLKs&":B"&myBLKe+myBLKs),2,0),0),IF(AND(A3<>"",A2<>""),mayBE,""))
Copy down for as many rows are in column A

My output:
Cartel1
AB
1
2Employee1Qty
3AA1
4BB2
5CC3
6DD4
7 
8Employee2 
9AA0
10BB22
11CC23
12DD0
13 
14Employee3 
15AA0
16BB0
17CC0
18DD0
19 
20 
Sheet2
Cell Formulas
RangeFormula
B3:B20B3=LET(EMPL,INDIRECT("A"&1+MAX(IF($A$1:A1="",ROW($A$1:A1),""))),myBLKs,MATCH(EMPL,Sheet1!$A$1:$A$100,0),myBLKe,MATCH("Total Units",INDIRECT("Sheet1!A"&myBLKs&":A100"),0),mayBE,IFERROR(VLOOKUP(A3,INDIRECT("Sheet1!A"&myBLKs&":B"&myBLKe+myBLKs),2,0),0),IF(AND(A3<>"",A2<>""),mayBE,""))
 
Upvote 0

Forum statistics

Threads
1,214,935
Messages
6,122,337
Members
449,077
Latest member
Jocksteriom

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