MATCH TRUE INDEX - Where does small come in to it??!!?

Robbiehof

New Member
Joined
Jan 28, 2015
Messages
7
Hi Guys, I am completely stuck on this and could really do with some help. I am trying to display a column title when a unit sale (indicated by a 1) is placed below in the rows. The current set up I have, which is working perfectly is =IFERROR(IF(COUNTA($AC5:$BT5)=0,"",INDEX($AC$4:$BT$4,MATCH(TRUE,INDEX($AC5:$BT5>0,0),0))),"")

Row 4 being the Product Names, and Row 5 being in Product sale. This displays a blank where there is no sale, and pulls the column title where a unit has been sold.

The problem I am having is where there have been two different products sold i one sale, so the above formula is only picking up the first occurrence it sees. I want to add a new column which searches the same field but picks up the second occurrence, third, fourth and ongoing. I thought this would be a case of =IFERROR(IF(COUNTA($AC5:$BT5)=0,"",INDEX($AC$4:$BT$4,SMALL(MATCH(TRUE,INDEX($AC5:$BT5>0,0),0),2))),"") with the addition I have made in bold but this ends up showing blank.

So in the below example which is smaller than the above, Column b works fine, but I need Column C to Show a blank if there isnt a second occurrance (Like in Row 2 and 3) and to Show "Product 3" in C4. Hopefully this explains?
ABCDEFG
1Sale Unit 1Sale Unit 2Product 1Product 2Product 3
2Product 1Product 11
3Product 2Product 21
4Product 2 Product211

<tbody>
</tbody>



If anyone had any help, it would be much appreciated.

Cheers

Rob
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
Maybe something like this:
Change ranges for your data.
Drag formula across and down.
This is an array formula and must be entered with
Excel Workbook
ABCDEFG
11Sale Unit 1Sale Unit 2Product 1Product 2Product 3
22Product 11
33Product 21
44Product 2Product 311
CTRL-SHIFT-ENTER.
 
Upvote 0
Maybe something like this:
Change ranges for your data.
Drag formula across and down.
This is an array formula and must be entered with CTRL-SHIFT-ENTER.


*ABCDEFG
11Sale Unit 1Sale Unit 2*Product 1Product 2Product 3
22Product 1**1**
33Product 2***1*
44Product 2Product 3**11

<colgroup><col style="width: 30px; font-weight: bold;"><col style="width: 64px;"><col style="width: 84px;"><col style="width: 114px;"><col style="width: 64px;"><col style="width: 70px;"><col style="width: 67px;"><col style="width: 78px;"></colgroup><tbody>
</tbody>

Spreadsheet Formulas
CellFormula
B2{=IFERROR(INDEX($E$1:$G$1,SMALL(IF($E2:$G2=1,COLUMN($E$1:$G$1)-COLUMN($E$1)+1),COLUMNS($E$1:E1))),"")}

<tbody>
</tbody>
Formula Array:
Produce enclosing
{ } by entering
formula with CTRL+SHIFT+ENTER!

<tbody>
</tbody>


Excel tables to the web >> Excel Jeanie HTML 4

Well there you go, this is truly amazing!! Looks like I have some new functions to learn. I have one last questions, if for example F4 was "2", this formula does not pick it up, as it is searching for 1's only, I tried changing SMALL(IF($E2:$G2=1,COLUMN to SMALL(IF($E2:$G2=">.5",COLUMN or "<>0" but its having non of it. Could you kkindly advise?

Many thanks for your help so far!

Robbiehof
 
Upvote 0
You were close. Remove the quotes from the ">.5".
Based on your example you could change formula to:

Code:
=IFERROR(INDEX($E$1:$G$1,SMALL(IF($E2:$G2[COLOR=#ff0000]>=0.5[/COLOR],COLUMN($E$1:$G$1)-COLUMN($E$1)+1),COLUMNS($E$1:E$1))),"")
or
=IFERROR(INDEX($E$1:$G$1,SMALL(IF($E2:$G2[COLOR=#ff0000]<>""[/COLOR],COLUMN($E$1:$G$1)-COLUMN($E$1)+1),COLUMNS($E$1:E$1))),"")

This part of the formula COLUMN($E$1:$G$1)-COLUMN($E$1)+1) just returns the column numbers in the table (range). In this case {1,2,3}.
This part COLUMNS($E$1:E$1) returns K in the SMALL function. So E1:E1 returns 1 and as you drag across columns E1:F1 returns 2, etc.
Excel Workbook
ABCDEFG
11Sale Unit 1Sale Unit 2Product 1Product 2Product 3
22Product 12
33Product 21
44Product 2Product 331
Sheet
 
Upvote 0
You were close. Remove the quotes from the ">.5".
Based on your example you could change formula to:

Code:
=IFERROR(INDEX($E$1:$G$1,SMALL(IF($E2:$G2[COLOR=#ff0000]>=0.5[/COLOR],COLUMN($E$1:$G$1)-COLUMN($E$1)+1),COLUMNS($E$1:E$1))),"")
or
=IFERROR(INDEX($E$1:$G$1,SMALL(IF($E2:$G2[COLOR=#ff0000]<>""[/COLOR],COLUMN($E$1:$G$1)-COLUMN($E$1)+1),COLUMNS($E$1:E$1))),"")

This part of the formula COLUMN($E$1:$G$1)-COLUMN($E$1)+1) just returns the column numbers in the table (range). In this case {1,2,3}.
This part COLUMNS($E$1:E$1) returns K in the SMALL function. So E1:E1 returns 1 and as you drag across columns E1:F1 returns 2, etc.

*ABCDEFG
11Sale Unit 1Sale Unit 2*Product 1Product 2Product 3
22Product 1**2**
33Product 2***1*
44Product 2Product 3**31

<colgroup><col style="width: 30px; font-weight: bold;"><col style="width: 44px;"><col style="width: 78px;"><col style="width: 76px;"><col style="width: 36px;"><col style="width: 79px;"><col style="width: 78px;"><col style="width: 81px;"></colgroup><tbody>
</tbody>

Spreadsheet Formulas
CellFormula
B2{=IFERROR(INDEX($E$1:$G$1,SMALL(IF($E2:$G2>0.5,COLUMN($E$1:$G$1)-COLUMN($E$1)+1),COLUMNS($E$1:E$1))),"")}

<tbody>
</tbody>
Formula Array:
Produce enclosing
{ } by entering
formula with CTRL+SHIFT+ENTER!

<tbody>
</tbody>


Excel tables to the web >> Excel Jeanie HTML 4

Ahh PERFECT! I had G2=>.5 whereas i needed G2>=.5.

thank you both for your help and speedy replies. This really is a great website.

Thanks again.

Robbiehof
 
Upvote 0
You're welcome. Thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,217,314
Messages
6,135,800
Members
449,965
Latest member
Ckl43

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