Search

chrisb182

New Member
Joined
Mar 3, 2022
Messages
35
Office Version
  1. 2016
Platform
  1. Windows
Hi,

Sorry - but I have another query.

Again, it's a question I've searched on the forum but to no avail.

I want to search a number of columns for a specific code and for it to return the value in the corresponding row.

For example, as shown in the attached screenshot I would like:
- a formula in H4
- that would look up the text from G4
- in the range C4:E9
- and for it to return the relevant text in range B4:B9

Note: As the codes are random yet unique, the figures for one code could appear in more than one cell (as shown in the example, the numbers 1234 can be found in cells C4, C5, D6 and D8 as well)...... in a nutshell, I need an exact match.

I hope that makes sense.

Cheers,

Chris
 

Attachments

  • Mr Excel Question2.png
    Mr Excel Question2.png
    16.3 KB · Views: 8

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
How about
Excel Formula:
=INDEX($B$4:$B$9,AGGREGATE(15,6,(ROW($B$4:$B$9)-ROW($B$4)+1)/($C$4:$E$9=H4),1))
 
Upvote 0
Hi,

Thanks for the swift response.

The attached example was a small snapshot of the information I'm dealing with.

There are loads of codes going down in column G and when I entered in the above formula and dragged it down in column H, it brought up the same answer all the way down. Is there anything that I'm missing here?

What does the "AGGREGATE (15,6," part of the formula mean?

(Oh - and did you mean "=G4" in the above formula?)
 
Upvote 0
I hope this works:

mR eXCEL.xlsx
ABCDEFG
1NameCode1Code2Code3CodeName
2AndyAA1234X256728187027TNN
3SamAA1234X3IBHN9U2
4KevinQT567TFAA1234X4AFANG80U
5LisaCJ17085A567
6Pete99RBFBAA1234X4567
7FayeMC44489CM44578T1234SEDDY69
8TonyAFANG80UVSNKBWAA1234X2
9VickiVBUH7980AA1234X4
10JackKSVK88NBKSDFBH7SRHOE99
11CarlVSN8SI111GBBBB999SEDDY72AA1234X4
12SelinaABDFKR39987027TNNABDFKR399
13Arthur2TU304NSEDDY69281
14LincolnIBHN9U287027TNN
15EleshaSRHOE991234
16SEDDY69
17MC44489
18BBBB999
19AA1234X4
201234
21IBHN9U2
22IBHN9U2
23AA1234X4
24SRHOE99
25281
26AA1234X2
271234
28AFANG80U
29CM44578T
3087027TNN
31SEDDY69
32VSN8SI111G
33AA1234X3
34SEDDY72
35SEDDY72
36MC44489
37AA1234X2
381234
39SRHOE99
40567
41281
421234
43AA1234X4
4487027TNN
45567
46VSNKBW
47SEDDY72
48VSNKBW
49VSN8SI111G
50ABDFKR399
51KSVK88
52NBKSDFBH7
53567
5487027TNN
55281
56QT567TF
57ABDFKR399
58SEDDY69
59AA1234X2
60NBKSDFBH7
61VSNKBW
62AA1234X3
63AA1234X4
64QT567TF
65ABDFKR399
66VSN8SI111G
67AFANG80U
68AA1234X4
69CM44578T
702TU304N
7187027TNN
72BBBB999
7399RBFB
74SEDDY69
75AA1234X3
761234
77AA1234X2
78SEDDY69
7999RBFB
80AFANG80U
81281
82NBKSDFBH7
83QT567TF
84NBKSDFBH7
85ABDFKR399
86AA1234X4
87AA1234X4
88AA1234X3
89NBKSDFBH7
90MC44489
91QT567TF
92ABDFKR399
93AA1234X2
942TU304N
95AA1234X4
96567
971234
98CJ17085A
99567
100AA1234X3
101VSN8SI111G
10299RBFB
103NBKSDFBH7
10499RBFB
105281
106NBKSDFBH7
107IBHN9U2
108KSVK88
109567
110281
111BBBB999
112281
113VSNKBW
114KSVK88
115AA1234X4
116567
1171234
118NBKSDFBH7
119ABDFKR399
120VSNKBW
121IBHN9U2
122IBHN9U2
1231234
124SRHOE99
125SEDDY69
126AA1234X3
127567
128AA1234X4
129QT567TF
Sheet1
 
Upvote 0
Thanks for that. What should G6 display as that is the 2nd 567 & there is only one cell with that value in columns B:D?
 
Upvote 0
Try this ctrl shift enter

Excel Formula:
=INDEX($A$2:$A$15,MAX(--($B$2:$D$15=F2)*(ROW($A$2:$A$15)-1)))
 

Attachments

  • 1676311771293.png
    1676311771293.png
    61.7 KB · Views: 11
Upvote 0
Thanks for that. What should G6 display as that is the 2nd 567 & there is only one cell with that value in columns B:D?
The name can appear more than once in column G, so 'Andy' should appear in both G5 and G6.
 
Upvote 0
Ok, how about
Excel Formula:
=IFERROR(INDEX($A$2:$A$15,AGGREGATE(15,6,(ROW($A$2:$A$15)-ROW($A$2)+1)/($B$2:$D$15=F2),COUNTIFS(F$2:F2,F2))),INDEX($A$2:$A$15,AGGREGATE(15,6,(ROW($A$2:$A$15)-ROW($A$2)+1)/($B$2:$D$15=F2),1)))
 
Upvote 0

Forum statistics

Threads
1,215,444
Messages
6,124,891
Members
449,194
Latest member
JayEggleton

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