Formula for returning text list and quantity from table

esamk

New Member
Joined
Jun 26, 2020
Messages
9
Office Version
  1. 2013
Platform
  1. Windows
I have a named table of data e.g:

ABCD
1P/NDESCRQTYPRICE
2001-abcNut self locking$0.15
3dc-107-012Bolt flange head2$0.45
4seg1089Nut castle$1.00
5101908457Pin cotter16$1.10

A/B formatted as text, C as general (to calculate totals separately). There are a lot more columns in the original but I didn't want to clutter up the example.

It has an order overview tab, which I would like to display only the items where a quantity has been added to the original table (excluding all the blanks). For the above example:

AB
1DESCRQTY
2Bolt flange head2
3Pin cotter16
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
Hi, I would create a Pivot Table, set it as you like and remove the display options. PivotTable Options / Display, then untick all the Display boxes. This will give you a table that you need and look like a regular table.
 
Upvote 0
Hi Esamk,

Does this do what you want?

Here's the Data tab:

Book3
ABCD
1P/NDESCRQTYPRICE
2001-abcNut self locking$0.15
3dc-107-012Bolt flange head2$0.45
4seg1089Nut castle$1.00
5101908457Pin cotter16$1.10
Data


Here's the Order Overview tab

Book3
AB
1DESCQTY
2Bolt flange head2
3Pin cotter16
Order Overview
Cell Formulas
RangeFormula
A2:A3A2=IFERROR(INDEX(Data!$B$2:$B$999,AGGREGATE(15,6,ROW(Data!$B$2:$B$999)-ROW(Data!$B$1)/(Data!$C$2:$C$999<>""),ROW()-ROW($A$1))),"")
B2:B3B2=IFERROR(INDEX(Data!$C$2:$C$999,AGGREGATE(15,6,ROW(Data!$B$2:$B$999)-ROW(Data!$B$1)/(Data!$C$2:$C$999<>""),ROW()-ROW($A$1))),"")
 
Upvote 0
Hi Esamk,

Does this do what you want?

- Perfect, exactly what I need. Had to change B2 from:

=IFERROR(INDEX(Data!$C$2:$C$999,AGGREGATE(15,6,ROW(Data!$B$2:$B$999)-ROW(Data!$B$1)/(Data!$C$2:$C$999<>""),ROW()-ROW($A$1))),"")

To:

=IFERROR(INDEX(Data!$C$2:$C$999,AGGREGATE(15,6,ROW(Data!$C$2:$C$999)-ROW(Data!$B$1)/(Data!$C$2:$C$999<>""),ROW()-ROW($A$2))),"")

For it to work properly. And had to set "$A$2" so it didn't skip the first row. Thank you so much!


Hi, I would create a Pivot Table, set it as you like and remove the display options. PivotTable Options / Display, then untick all the Display boxes. This will give you a table that you need and look like a regular table.

- Ideally, yes. However it needs to be print friendly which the table is not (too much data). That's why I need a formula.

Only one last issue to solve. Due to the unusual format of the overview sheet (has to print landscape annoyingly), I need the formula to work across two sets of columns. E.g:

ABCD
1
DESCR
QTY
DESCR
QTY
2Bolt flange head
2​
R-Clip
100​
3Pin cotter
16​
O-ring
50​
4Widget S/S
22​
Bearing roller
12​

Just to add to the challenge... so when it reaches the last row (17/18) it needs to start again at the top a few columns over.
 
Upvote 0
Hi Esamk,

You don't need to change Data!$B$2:$B$999 to Data!$C$2:$C$999 because it only needs to use the row numbers, not the actual content of those cells.

You don't need to change ROW($A$1) to ROW($A$2) unless your headings are actually in row 2. It's using "ROW()-ROW($A$1)" to figure out which occurrence to select (1st, 2nd, 3rd, etc) so if your headings are on row 1 and the formula starts row 2 then ROW()-ROW($A$1) = 2-1 = 1 so you get the first.

Here's some extra data to trigger the second column and a modified formula for your columns C and D.


Esamk2.xlsx
ABCD
1P/NDESCRQTYPRICE
2001-abcNut self locking$0.15
3dc-107-012Bolt flange head2$0.45
4seg1089Nut castle$1.00
5101908457Pin cotter16$1.10
6X-H6Widget S/S22$0.15
7X-H7R-Clip100$0.45
8X-H8O-ring50$1.00
9X-H9Bearing roller12$1.10
10X-H10L/H Widget nut4$0.15
11X-H11L/H Widget bolt3$0.45
12X-H12R/H Widget nut5$1.00
13X-H13R/H Widget bolt6$1.10
14X-H14O/set x/over driver7$0.15
15X-H15Lug nut8$0.45
16X-H16P-bracket9$1.00
17X-H17Jumper 172$1.10
18X-H18Jumper 181$0.15
19X-H19Jumper 1911$0.45
20X-H20Jumper 2012$1.00
21X-H21Jumper 2144$1.10
22X-H22Jumper 2266$1.00
23X-H23Jumper 2388$1.10
Data


Cell Formulas
RangeFormula
A2:A18A2=IFERROR(INDEX(Data!$B$2:$B$999,AGGREGATE(15,6,ROW(Data!$B$2:$B$999)-ROW(Data!$B$1)/(Data!$C$2:$C$999<>""),ROW()-ROW($A$1))),"")
B2:B18B2=IFERROR(INDEX(Data!$C$2:$C$999,AGGREGATE(15,6,ROW(Data!$B$2:$B$999)-ROW(Data!$B$1)/(Data!$C$2:$C$999<>""),ROW()-ROW($A$1))),"")
C2:C18C2=IFERROR(INDEX(Data!$B$2:$B$999,AGGREGATE(15,6,ROW(Data!$B$2:$B$999)-ROW(Data!$B$1)/(Data!$C$2:$C$999<>""),ROW()-ROW($A$1)+COUNTIF($B$2:$B$18,"<>"))),"")
D2:D18D2=IFERROR(INDEX(Data!$C$2:$C$999,AGGREGATE(15,6,ROW(Data!$B$2:$B$999)-ROW(Data!$B$1)/(Data!$C$2:$C$999<>""),ROW()-ROW($A$1)+COUNTIF($B$2:$B$18,"<>"))),"")
 
Upvote 0
Here's some extra data to trigger the second column and a modified formula for your columns C and D.

Hi Toadstool

That's excellent, works great! Thank you so much for you help :), If only I could get back the wasted hours googling the problem and trying to work it out myself haha. Now I just need to figure out how to mark the thread as solved...

Much appreciated
 
Upvote 0

Forum statistics

Threads
1,214,918
Messages
6,122,257
Members
449,075
Latest member
staticfluids

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