Trouble with a formula returning duplicate values

MichaelLFC96

New Member
Joined
Apr 10, 2024
Messages
10
Office Version
  1. 365
Platform
  1. Windows
Hi all, first time poster, bit of an excel novice but I can manipulate and adapt formulas to fit :)

I have a scrap spreadsheet that contains values in cells B4:AA69, with parts listed in columns A2:A69, and reasons for scrapping in rows B4:B69.

I have made a table below that would return the top 5 parts that have resulted in the highest amounts of scrap,

Top 5 by Part/Fault
PartLookup ValueResult
P33B Dash outer RHD E power10.00Torn / Incomplete Trim
P33B Dash outer RHD E power10Torn / Incomplete Trim
P33B Dash outer RHD E power7Raw material blank unprocessed
P33B Dash outer RHD E power7Raw material blank unprocessed
P33B Boot insulator HT6Processed blank



Now as you can see it's resulting in duplicate values producing the same results, whereas I would like it to pick up the next instance of 10 in the spreadsheet, the formula for part column is =INDEX($A$4:$A$69,SUMPRODUCT(MAX(($B$4:$AA$69=B104)*(ROW($A$4:$A$69))))-ROW(A4)+1), and the formula for the result column is =INDEX($B$2:$AA$2,SUMPRODUCT(MAX(($B$4:$AA$69=B104)*(COLUMN($B$4:$AA$69))))-COLUMN($B$2)+1).

If the data in B4:AA69 has sequential numbers i.e 10,9,8,7 and 6 in the lookup value column, it works perfectly fine, but I have racked my brains to try and adjust it to return different results for the same value but to no avail, could anybody point me in the right direction? :)
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
Post your actual sheet layout. Can't diagnose the issue.
 
Upvote 0
You might have to do it in chunks. Then combine them.
 
Upvote 0
Post your actual sheet layout. Can't diagnose the issue.
1713361150137.png

Here is a screenshot, with this table below with formula to give an idea of what's happening

1713361196599.png


Thanks for your efforts so far, much appreciated :)
 
Upvote 0
See if this give you an error first. If it doesn't ....
Excel Formula:
TEXTSPLIT(TEXTJOIN(",",TRUE,TOCOL(A4:A69 & "|" & B2:AA2,3)),"|",",")

Try this...
Excel Formula:
=LET(t,TEXTSPLIT(TEXTJOIN(",",TRUE,TOCOL(A4:A69 & "|" & B2:AA2,3)),"|",","),
br,BYROW(t,LAMBDA(r,INDEX(B4:AA69,MATCH(DROP(r,0,-1),A4:A69,0),MATCH(DROP(r,0,1),B2:AA2,0)))),
TAKE(SORT(HSTACK(t,br),3,-1),5))

If the first formula gives you an error, will have to think about a different arpproach.
 
Upvote 0
See if this give you an error first. If it doesn't ....
Excel Formula:
TEXTSPLIT(TEXTJOIN(",",TRUE,TOCOL(A4:A69 & "|" & B2:AA2,3)),"|",",")

Try this...
Excel Formula:
=LET(t,TEXTSPLIT(TEXTJOIN(",",TRUE,TOCOL(A4:A69 & "|" & B2:AA2,3)),"|",","),
br,BYROW(t,LAMBDA(r,INDEX(B4:AA69,MATCH(DROP(r,0,-1),A4:A69,0),MATCH(DROP(r,0,1),B2:AA2,0)))),
TAKE(SORT(HSTACK(t,br),3,-1),5))

If the first formula gives you an error, will have to think about a different arpproach.

See if this give you an error first. If it doesn't ....
Excel Formula:
TEXTSPLIT(TEXTJOIN(",",TRUE,TOCOL(A4:A69 & "|" & B2:AA2,3)),"|",",")

Try this...
Excel Formula:
=LET(t,TEXTSPLIT(TEXTJOIN(",",TRUE,TOCOL(A4:A69 & "|" & B2:AA2,3)),"|",","),
br,BYROW(t,LAMBDA(r,INDEX(B4:AA69,MATCH(DROP(r,0,-1),A4:A69,0),MATCH(DROP(r,0,1),B2:AA2,0)))),
TAKE(SORT(HSTACK(t,br),3,-1),5))

If the first formula gives you an error, will have to think about a different arpproach.
I tried both, both are returning #CALC errors :(

I'm surprised I can't tweak my formula that is returning the result to go to the next duplicate value row and header, it seems like a simple tweak but I can't find anything anywhere😵‍💫
 
Upvote 0
Is it #Calc! error or #Value! error? I don't have the sample that is representative of your data so can't do much. Can you post your sheet into a DropBox?
 
Upvote 0
Is it #Calc! error or #Value! error? I don't have the sample that is representative of your data so can't do much. Can you post your sheet into a DropBox?
It is a #calc error, but when I click on it it says text too long :(

Dropbox isn't a viable option for myself so I may have to just keep making amendments to the formula with +/- at the end to pick up the correct data which isn't ideal but I can work with it, thanks for your attempts though it's much apppreciated!
 
Upvote 0
Based on MS documentation, it should give a #VALUE if it's too long. Not sure what the #CALC means as I've never encountered it before.
 
Upvote 0

Forum statistics

Threads
1,215,205
Messages
6,123,634
Members
449,109
Latest member
Sebas8956

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