Find the same value of a cell in a range of cells

bluefeather8989

Active Member
Joined
Nov 20, 2009
Messages
325
Office Version
  1. 365
Platform
  1. Windows
for each cell that has a value in range M4:M9 find that same value in range AE2:AQ65 then add the name from L3 to the empty cell next to the number. I need sheets reference, Sheets ("DR").

Example: L3 value is John Smith. M4 value is 212 marco will find 212 in range AE2:AQ65 witch is cell AG13 input the name John Smith in cell AH 13.

Untitled2.png
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
Okay, i cannot post more than 3000 cells for you. But here is a non macro solution:
you'll have to adjust columns as necessary:

mr excel questions 24.xlsm
KLMNOPQRSTU
1
2101 201 301 401 
3John Smith102 202 302 402 
41212103 203 303 403 
52104 204 304 404 
63313105 205 305 405 
74213106 206 306 406 
85903107 207 307 407 
96108 208 308 408 
10109 209 309 409 
11110 210 310 410 
12111 211 311 411 
13112 212John Smith312 412 
14113 213John Smith313John Smith413 
15114 214 314 414 
16115 215 315 415 
17116 216 316 416 
18117 217 317 417 
19118 218 318 418 
20119 219 319 419 
21120 220 320 420 
22121 221 321 421 
23122 222 322 422 
24123 223 323 423 
25124 224 324 424 
26125 225 325 425 
27126 226 326 426 
28127 227 327 427 
29128 228 328 428 
30129 229 329 429 
31130 230 330 430 
32131 231 331 431 
33132 232 332 432 
34133 233 333 433 
35134 234 334 434 
36135 235 335 435 
37136 236 336 436 
38137 237 337 437 
39138 238 338 438 
40139 239 339 439 
41140 240 340 440 
42141 241 341 441 
43142 242 342 442 
44143 243 343 443 
45144 244 344 444 
46145 245 345 445 
47146 246 346 446 
48147 247 347 447 
49148 248 348 448 
50149 249 349 449 
51150 250 350 450 
52151 251 351 451 
53152 252 352 452 
54153 253 353 453 
55154 254 354 454 
56155 255 355 455 
57156 256 356 456 
58157 257 357 457 
59158 258 358 458 
60159 259 359 459 
61160 260 360 460 
62161 261 361 461 
63162 262 362 462 
64163 263 363 463 
65164 264 364 464 
66165 265 365 465 
67166 266 366 466 
68167 267 367 467 
69168 268 368 468 
70169 269 369 469 
71170 270 370 470 
72171 271 371 471 
73172 272 372 472 
74173 273 373 473 
75174 274 374 474 
76175 275 375 475 
77176 276 376 476 
78177 277 377 477 
79178 278 378 478 
80179 279 379 479 
81180 280 380 480 
82181 281 381 481 
83182 282 382 482 
84183 283 383 483 
85184 284 384 484 
86185 285 385 485 
87186 286 386 486 
88187 287 387 487 
89188 288 388 488 
90189 289 389 489 
91190 290 390 490 
92191 291 391 491 
93192 292 392 492 
94193 293 393 493 
95194 294 394 494 
96195 295 395 495 
97196 296 396 496 
98197 297 397 497 
99198 298 398 498 
100199 299 399 499 
101200 300 400 500 
jpalmer20
Cell Formulas
RangeFormula
K4:K9K4=SEQUENCE(6,1,1,1)
O2:O101,U2:U101,S2:S101,Q2:Q101O2=IF(ISNUMBER(MATCH(N2,$M$4:$M$9,0)),$L$3,"")
Dynamic array formulas.
 
Upvote 0
Hi bluefeather8989,

Here is a possible macro solution:

VBA Code:
Option Explicit
Sub Macro1()

    Dim ws As Worksheet
    Dim rngCell As Range, rngFind As Range
    
    Application.ScreenUpdating = False
    
    Set ws = ThisWorkbook.Sheets("Sheet1") '<- Sheet name containing the data. Change to suit.
    
    For Each rngCell In ws.Range("M4:M9")
        If Len(rngCell.Value) > 0 Then
            Set rngFind = ws.Range("AE2:AQ65").Find(What:=CDbl(rngCell.Value), LookIn:=xlValues)
            If Not rngFind Is Nothing Then
                rngFind.Offset(0, 1).Value = ws.Range("L3")
                Set rngFind = Nothing
            End If
        End If
    Next rngCell
    
    Application.ScreenUpdating = True

End Sub

Regards,

Robert
 
Upvote 1
Solution
Hi bluefeather8989,

Here is a possible macro solution:

VBA Code:
Option Explicit
Sub Macro1()

    Dim ws As Worksheet
    Dim rngCell As Range, rngFind As Range
   
    Application.ScreenUpdating = False
   
    Set ws = ThisWorkbook.Sheets("Sheet1") '<- Sheet name containing the data. Change to suit.
   
    For Each rngCell In ws.Range("M4:M9")
        If Len(rngCell.Value) > 0 Then
            Set rngFind = ws.Range("AE2:AQ65").Find(What:=CDbl(rngCell.Value), LookIn:=xlValues)
            If Not rngFind Is Nothing Then
                rngFind.Offset(0, 1).Value = ws.Range("L3")
                Set rngFind = Nothing
            End If
        End If
    Next rngCell
   
    Application.ScreenUpdating = True

End Sub

Regards,

Robert
This works but only for the last number in the range (903)
Untitled4.png
 
Upvote 0
This works but only for the last number in the range (903)

That's odd as it works for me :confused:

Are you sure the numbers to be searched are in the range M4:M9? Are the cells merged?
 

Attachments

  • bluefeather8989.jpg
    bluefeather8989.jpg
    58.5 KB · Views: 5
Upvote 0
That's odd as it works for me :confused:

Are you sure the numbers to be searched are in the range M4:M9? Are the cells merged?
I am so stupid. I forgot to format the cells Tex color to white. It was set to default black. The names where there I just couldn't see it. Thanks for the help. LMAO 🤣
✌️
 
Upvote 0
Thanks for letting us know and glad you got it sorted :)
 
Upvote 0

Forum statistics

Threads
1,216,166
Messages
6,129,257
Members
449,497
Latest member
The Wamp

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