Nested index match if countif statement

VKat13

New Member
Joined
Jan 14, 2014
Messages
19
Was wondering if someone out there could assist? I am building a sales data report (in Excel 2010) for our field team in which they can enter in an account number for one of their stores and the report spits out the top 6 selling items in order of sales rank.</SPAN>

I have the following formula which will return the heading (Sales Item) based on the rank:</SPAN>

Code:
=IF(COUNTIF(B2:G2,1),LOOKUP(2,1/(B2:G2=1),B1:G1),"")</SPAN>

I have tried combining this with an INDEX/MATCH statement to reference only the row relevant to the user inputted Acct # but it returns a #VALUE error. </SPAN>

My expected result and data is as per below:</SPAN>

Hopefully I make sense and hoping someone out there will be able to shed some light on how this can be done? </SPAN>

Greatly appreciate any assistance anyone can provide. </SPAN>

Thanks</SPAN>
Kate</SPAN></SPAN>

SALES TABLE<o:p></o:p>
<o:p></o:p>

<o:p></o:p>

A<o:p></o:p>

B<o:p></o:p>

C<o:p></o:p>

D<o:p></o:p>

E<o:p></o:p>

F<o:p></o:p>

G<o:p></o:p>
SAMPLE OUTPUT<o:p></o:p>

1<o:p></o:p>

Acct.#<o:p></o:p>
Banana<o:p></o:p>
Pineapple<o:p></o:p>
Apple<o:p></o:p>
Orange<o:p></o:p>
Peach <o:p></o:p>
Cherry<o:p></o:p>
Acct #<o:p></o:p>

123456<o:p></o:p>

2<o:p></o:p>

123456<o:p></o:p>

750<o:p></o:p>

223<o:p></o:p>

124<o:p></o:p>

653<o:p></o:p>

121<o:p></o:p>

353<o:p></o:p>

3<o:p></o:p>

234567<o:p></o:p>

167<o:p></o:p>

712<o:p></o:p>

653<o:p></o:p>

862<o:p></o:p>

456<o:p></o:p>

332<o:p></o:p>

Sales Rank<o:p></o:p>
Fruit Type<o:p></o:p>

4<o:p></o:p>

345678<o:p></o:p>

123<o:p></o:p>

223<o:p></o:p>

122<o:p></o:p>

552<o:p></o:p>

665<o:p></o:p>

125<o:p></o:p>

1<o:p></o:p>

Banana<o:p></o:p>

5<o:p></o:p>

456789<o:p></o:p>

653<o:p></o:p>

356<o:p></o:p>

233<o:p></o:p>

421<o:p></o:p>

352<o:p></o:p>

147<o:p></o:p>

2<o:p></o:p>

Orange<o:p></o:p>

6<o:p></o:p>

567891<o:p></o:p>

225<o:p></o:p>

455<o:p></o:p>

458<o:p></o:p>

674<o:p></o:p>

223<o:p></o:p>

225<o:p></o:p>

3<o:p></o:p>

Cherry<o:p></o:p>

7<o:p></o:p>

678911<o:p></o:p>

682<o:p></o:p>

653<o:p></o:p>

585<o:p></o:p>

365<o:p></o:p>

665<o:p></o:p>

109<o:p></o:p>

4<o:p></o:p>

Pineapple<o:p></o:p>

8<o:p></o:p>

789112<o:p></o:p>

885<o:p></o:p>

128<o:p></o:p>

721<o:p></o:p>

428<o:p></o:p>

158<o:p></o:p>

289<o:p></o:p>

5<o:p></o:p>

Apple<o:p></o:p>

6<o:p></o:p>

Peach<o:p></o:p>
RANKING TABLE<o:p></o:p>
<o:p></o:p>

A<o:p></o:p>

B<o:p></o:p>

C<o:p></o:p>

D<o:p></o:p>

E<o:p></o:p>

F<o:p></o:p>

G<o:p></o:p>

1<o:p></o:p>

Acct.#<o:p></o:p>
Banana<o:p></o:p>
Pineapple<o:p></o:p>
Apple<o:p></o:p>
Orange<o:p></o:p>
Peach <o:p></o:p>
Cherry<o:p></o:p>

2<o:p></o:p>

123456<o:p></o:p>

1<o:p></o:p>

4<o:p></o:p>

5<o:p></o:p>

2<o:p></o:p>

6<o:p></o:p>

3<o:p></o:p>

3<o:p></o:p>

234567<o:p></o:p>

6<o:p></o:p>

2<o:p></o:p>

3<o:p></o:p>

1<o:p></o:p>

4<o:p></o:p>

5<o:p></o:p>

4<o:p></o:p>

345678<o:p></o:p>

5<o:p></o:p>

3<o:p></o:p>

6<o:p></o:p>

2<o:p></o:p>

1<o:p></o:p>

4<o:p></o:p>

5<o:p></o:p>

456789<o:p></o:p>

1<o:p></o:p>

3<o:p></o:p>

5<o:p></o:p>

2<o:p></o:p>

4<o:p></o:p>

6<o:p></o:p>

6<o:p></o:p>

567891<o:p></o:p>

5<o:p></o:p>

3<o:p></o:p>

2<o:p></o:p>

1<o:p></o:p>

6<o:p></o:p>

5<o:p></o:p>

7<o:p></o:p>

678911<o:p></o:p>

1<o:p></o:p>

3<o:p></o:p>

4<o:p></o:p>

5<o:p></o:p>

2<o:p></o:p>

6<o:p></o:p>

8<o:p></o:p>

789112<o:p></o:p>

1<o:p></o:p>

6<o:p></o:p>

2<o:p></o:p>

3<o:p></o:p>

5<o:p></o:p>

4<o:p></o:p>



<TBODY>
</TBODY>
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
Hi Kate,

Try this small modification in your formula:

Layout

Acct.#BananaPineappleAppleOrangePeachCherrySALES TABLESAMPLE OUTPUT
123456750223124653121353Acct #123456
234567167712653862456332Sales RankFruit Type
3456781232231225526651251Banana
4567896533562334213521472Orange
5678912254554586742232253Cherry
6789116826535853656651094Pineapple
7891128851287214281582895Apple
6Peach
*
Acct.#BananaPineappleAppleOrangePeachCherryRANKING TABLE
123456145263
234567623145
345678536214
456789135246
567891532165
678911134526
789112162354
********************************************************************************************

<tbody>
</tbody>

Formula

Code:
In J4

=IF(COUNTIF(INDEX($B$12:$G$18,MATCH($J$2,$A$12:$A$18,0),),$I4),
LOOKUP(2,1/(INDEX($B$12:$G$18,MATCH($J$2,$A$12:$A$18,0),)=$I4),$B$11:$G$11),"")

Markmzz
 
Upvote 0
Perfect!
Thanks so much for taking the time to look at this Markmzz. Very much appreciated!
 
Upvote 0

Forum statistics

Threads
1,214,978
Messages
6,122,549
Members
449,089
Latest member
davidcom

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