Generate related lists of products that have similar attributes

camspy

New Member
Joined
Jan 7, 2022
Messages
43
Office Version
  1. 2021
  2. 2019
Platform
  1. Windows
We have a list of products in column A.
Each product has its set of attributes in column B.

The task is to generate a product with its 6 related products (in column C), which have similar attributes to that product, sorted by similarity.

Similar attributes mean that the products share a similar set of attributes. The more matching attributes, the more similar the product is.

Then, the most similar product goes to the top of the list, and the least similar product goes to the bottom.

The result should exclude the product for which we generated the list.

I provide sample data below.
In C2, I have put an example of what the result should look like.

sort.xlsx
ABC
1ProductAtributesResult: 6 related products
2Applepackaging,quantity,reliability,size,design,material,id,contentPear,Orange,Lemon,Fig,Lime,Lychee
3Apricotmake,content,brand,purpose,feel,color,id,photos,weight,packaging
4Avocadoreliability,size,design,taste,smell,feel
5Bananaquantity,design,safety,brand,smell,id,feel,photos
6Duriansize,color,content,feel,smell,quantity,brand,price,reliability
7Figpackaging,safety,weight,id,videos,photos
8Grapefruitweight,purpose,photos,packaging,material,make,color,content,videos,taste
9Grapesquantity,reliability,size,make,material,purpose,content,price
10Lemonpackaging,reliability,design,weight,smell,photos
11Limepackaging,quantity,weight,make,taste,material,price,feel
12Lycheeweight,content,taste,reliability,design,material,size,price,purpose,feel
13Mangotaste,material,purpose,feel,videos,photos
14Nectarinereliability,size,safety,make,material,content,color,photos
15Orangepackaging,quantity,reliability,make,purpose,smell,videos,photos
16Papayasize,design,weight,purpose,id,content
17Peachdesign,safety,content,price,feel,photos,price
18Pearpackaging,design,safety,taste,purpose,price
19Pineapplesafety,taste,content,price,feel,photos
20Plumreliability,size,make,material,content,color,price,photos
21Watermelonpackaging,quantity,safety,brand,make,taste,material,content
Sheet1



Thanks in advance.
 
Have you put code in module?
Could u share the screenshot of cell with UDF?
Yes, I've put the code in module and have double checked that it's there.

Screenshot_1.png
 
Upvote 0

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
In continuation to post14 these are the Attributes tally order
Apple
packaging,quantity,reliability,size,design,material,id,contentGrapes,Lychee,Durian,Grapefruit,Nectarine,Orange5,5,4,4,4,4
Apricotmake,content,brand,purpose,feel,color,id,photos,weight,packagingGrapefruit,Orange,Banana,Durian,Fig,Lime8,5,4,4,4,4
Avocadoreliability,size,design,taste,smell,feelLychee,Durian,Apple,Banana,Lemon,Grapes5,4,3,3,3,2
Bananaquantity,design,safety,brand,smell,id,feel,photosApricot,Durian,Orange,Peach,Apple,Avocado4,4,4,4,3,3
Duriansize,color,content,feel,smell,quantity,brand,price,reliabilityGrapes,Lychee,Plum,Apple,Apricot,Avocado5,5,5,4,4,4
Figpackaging,safety,weight,id,videos,photosGrapefruit,Apricot,Orange,Banana,Lemon,Mango5,4,4,3,3,3
Grapefruitweight,purpose,photos,packaging,material,make,color,content,videos,tasteApricot,Lime,Lychee,Mango,Nectarine,Orange7,5,5,5,5,5
Grapesquantity,reliability,size,make,material,purpose,content,priceLychee,Plum,Apple,Durian,Nectarine,Grapefruit6,6,5,5,5,4
Lemonpackaging,reliability,design,weight,smell,photosOrange,Apple,Apricot,Avocado,Banana,Fig4,3,3,3,3,3
Limepackaging,quantity,weight,make,taste,material,price,feelGrapefruit,Lychee,Watermelon,Apricot,Grapes,Apple5,5,5,4,4,3
Lycheeweight,content,taste,reliability,design,material,size,price,purpose,feelGrapes,Apple,Avocado,Durian,Grapefruit,Lime6,5,5,5,5,5
Mangotaste,material,purpose,feel,videos,photosGrapefruit,Lychee,Apricot,Lime,Orange,Pineapple5,4,3,3,3,3
Nectarinereliability,size,safety,make,material,content,color,photosPlum,Grapefruit,Grapes,Apple,Apricot,Durian7,5,5,4,4,4
Orangepackaging,quantity,reliability,make,purpose,smell,videos,photosGrapefruit,Apricot,Grapes,Lemon,Apple,Banana5,4,4,4,3,3
Papayasize,design,weight,purpose,id,contentLychee,Apple,Apricot,Grapefruit,Grapes,Avocado5,4,4,4,3,2
Peachdesign,safety,content,price,feel,photos,pricePineapple,Lychee,Banana,Durian,Pear,Plum6,5,4,4,4,4
Pearpackaging,design,safety,taste,purpose,priceLychee,Grapefruit,Lime,Peach,Pineapple,Watermelon4,3,3,3,3,3
Pineapplesafety,taste,content,price,feel,photosPeach,Lychee,Apricot,Banana,Durian,Grapefruit5,4,3,3,3,3
Plumreliability,size,make,material,content,color,price,photosNectarine,Grapes,Durian,Grapefruit,Lychee,Apple7,6,5,5,5,4
Watermelonpackaging,quantity,safety,brand,make,taste,material,contentGrapefruit,Lime,Apple,Apricot,Grapes,Nectarine5,5,4,4,4,4
 
Upvote 0
Hi @kvsrinivasamurthy!
I recently came up with a situation, when I needed to use your solution from this thread together with negative list.

So in short, I wanted to add one more column to the table, with a list of products that can't get listed as similar ones for the product from the same row.
Like if Apple can't have Grapes, Lemon go as similar products.

Is it possible to do?
 
Upvote 0
Hi @kvsrinivasamurthy!
I recently came up with a situation, when I needed to use your solution from this thread together with negative list.

So in short, I wanted to add one more column to the table, with a list of products that can't get listed as similar ones for the product from the same row.
Like if Apple can't have Grapes, go as similar products.

Is it possible to do?

Hi @kvsrinivasamurthy!
I recently came up with a situation, when I needed to use your solution from this thread together with negative list.

So in short, I wanted to add one more column to the table, with a list of products that can't get listed as similar ones for the product from the same row.
Like if Apple can't have Grapes, Lemon go as similar products.

Is it possible to do?
I was on long break because of personal problem. I will look into it tomorrow.
 
Upvote 0

Forum statistics

Threads
1,214,872
Messages
6,122,026
Members
449,061
Latest member
TheRealJoaquin

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