Help!

1AG

New Member
Joined
Apr 8, 2020
Messages
25
Office Version
  1. 2011
Platform
  1. Windows
Hello and thank you ahead of time! Been working on finding a code for my spreadsheet for quite some time now, so I am very grateful for this message board! Please help!

I have two sheets in a workbook. Sheet 1 contains data to be retrieved into Sheet 2.
Sheet 2!A1 is the "ID Number" to look up in Sheet 1 Column A, and Match or Lookup? if Sheet 1 Column D is "Yes", then return "Purple", if Column E is "Yes" then return "Red",if Column F is "Yes" then return "Blue",if Column G is "Yes" then return "Black"

The code I am working with and return value in:
Sheet 2 Cell D4
VLOOKUP(A1,Sheet 1!A:A,IF(Sheet 1!D:D="Yes","Purple),IF(Sheet 1!E:E="Yes","Red),"IF(Sheet 1!F:F="Yes","Blue),IF(Sheet 1!G:G="Black")))

Return value in Sheet 2 Cell D4 ---if D and F and G are all "Yes" , result should be Purple, Blue, Black

Hope I was able to explain what I am trying to achieve
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
Hi, welcome to the forum!

Here is one option you can try.

Book2
AB
1ID NumberResult
210Red
35Blue
46Purple
512Purple
615#N/A
78Blue
85Blue
94Black
Sheet1
Cell Formulas
RangeFormula
B2:B9B2=INDEX({"Purple","Red","Blue","Black"},MATCH("Yes",INDEX('Sheet 2'!D:G,MATCH(A2,'Sheet 2'!A:A,0),0),0))


Book2
ABCDEFG
1ID Number
27Yes
33Yes
48Yes
59Yes
65Yes
72Yes
86Yes
912Yes
1011Yes
1110Yes
121Yes
134Yes
Sheet 2
 
Upvote 0
Hi, welcome to the forum!

Here is one option you can try.

Book2
AB
1ID NumberResult
210Red
35Blue
46Purple
512Purple
615#N/A
78Blue
85Blue
94Black
Sheet1
Cell Formulas
RangeFormula
B2:B9B2=INDEX({"Purple","Red","Blue","Black"},MATCH("Yes",INDEX('Sheet 2'!D:G,MATCH(A2,'Sheet 2'!A:A,0),0),0))


Book2
ABCDEFG
1ID Number
27Yes
33Yes
48Yes
59Yes
65Yes
72Yes
86Yes
912Yes
1011Yes
1110Yes
121Yes
134Yes
Sheet 2



Hello and thank you, I appreciate the prompt reply, that formula worked! It is truly a blessing to be able to ask for help after so much time spent on trying to come up with a solution, thankful for the forum!
 
Upvote 0
In reference to:

Return value in Sheet 2 Cell D4 ---if D and F and G are all "Yes" , result should be Purple, Blue, Black

If D, F, and G are all "Yes", the formula is only returning Purple rather than Purple, Blue, Black as the text value.
 
Upvote 0
Return value in Sheet 2 Cell D4 ---if D and F and G are all "Yes" , result should be Purple, Blue, Black

Hi, yes - I missed that part. Assuming you have the textjoin() function available you can try this array formula instead.

Book8
AB
1ID NumberResult
210Red
35Purple, Red, Blue, Black
46Purple
512Purple
615#N/A
78Blue
81Purple, Red
94Black
Sheet1
Cell Formulas
RangeFormula
B2:B9B2=TEXTJOIN(", ",1,IF(INDEX('Sheet 2'!D:G,MATCH(A2,'Sheet 2'!A:A,0),0)="Yes",{"Purple","Red","Blue","Black"},""))
Press CTRL+SHIFT+ENTER to enter array formulas surrounded with curly braces.


Book8
ABCDEFG
1ID Number
27Yes
33Yes
48Yes
59Yes
65YesYesYesYes
72Yes
86Yes
912Yes
1011Yes
1110Yes
121YesYes
134Yes
Sheet 2
 
Upvote 0

Forum statistics

Threads
1,214,967
Messages
6,122,503
Members
449,090
Latest member
RandomExceller01

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