Excel, search data in different Sheet2 and put it back on Sheet1 based on their column

11392

New Member
Joined
Oct 20, 2020
Messages
5
Office Version
  1. 365
Platform
  1. Windows
This is Sheet1
zIqku.png


This is Sheet2
HO4of.png


I would like to search the Fruit in Sheet2, identify their group, and put it back in Sheet1, under column B (Group)

Desired output
psMj5.png

What is the best way to do this?
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
Hi & welcome to MrExcel.
How about
+Fluff v2.xlsm
ABC
1ABC
2aaabbbGrapes
3aaaccc
4Pearsbbbccc
5bbbccc
6Mangos
7
Sheet2


+Fluff v2.xlsm
AB
1FruitGroup
2GrapesC
3Apples-
4PearsA
5MangosB
Sheet1
Cell Formulas
RangeFormula
B2:B5B2=IFERROR(INDEX(Sheet2!$A$1:$C$1,AGGREGATE(15,6,(COLUMN(Sheet2!$A$1:$C$1)-COLUMN(Sheet2!$A$1)+1)/(Sheet2!$A$2:$C$10=A2),1)),"-")
 
Upvote 0
Thanks, it works on sample data.

Btw, I've question about this part.
AGGREGATE(15,6,(COLUMN(Sheet2!$A$1:$C$1)-COLUMN(Sheet2!$A$1)+1)/(Sheet2!$A$2:$C$10=A2),1)

What is the meaning of 1 in AGGREGATE function?


Based on link above, I know that:

AGGREGATE(function_num, options, array, [k])

15 is a function_num for function "SMALL"

6 is an Option to "Ignore error values"

(COLUMN(Sheet2!$A$1:$C$1)-COLUMN(Sheet2!$A$1)+1)/(Sheet2!$A$2:$C$10=A2)

is the "array"

and

1 is for [k].

What is the meaning of "1 is for [k]"?
 
Upvote 0
It means the 1st smallest value
 
Upvote 0

Forum statistics

Threads
1,214,983
Messages
6,122,583
Members
449,089
Latest member
Motoracer88

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