Search multiple columns for value, but within date range, return values of other column

cjtraas

New Member
Joined
Jun 24, 2013
Messages
9
Office Version
  1. 365
Platform
  1. Windows
Hi everyone. I've been pulling my hair out, getting close but still cannot get what I want to have happen.

My workbook contains multiple sheets. I need to search one sheet (or all 4 if possible), 3 columns, for a value - within a date range, and return a different value. Example below:
Book1
ABCDEFGH
112/27/2022SmithMike12/23/20224/6/2019Hastings
212/27/2022JonesKatie12/21/20226/26/1984Chad
312/29/2022JohnsonNelly12/27/20222/20/1974Phillips
41/3/2023BrownAlexander12/31/20224/28/1999Chad
51/4/2023MillerLuis1/2/20238/11/1995Chad
61/4/2023DavisMarrisa1/2/20236/30/2006Phillips
71/4/2023WilliamsAriana1/2/20237/11/2012Chad
81/5/2023BurkLeticia1/4/20234/12/1961Gulbransen
Sheet2

In this example, I would need to search for "Chad" in Sheet2 columns F:H, but within a date range in A:A (1/1/2022 - 3/24/2023), and return the names to Sheet 1 - from Sheet 2 column B (preferably "B, C" if possible). Example of what the output should look like.
Book1
A
1Brown, Alexander
2Miller, Luis
3Williams, Ariana
Sheet1


At an absolute minimum I would like to search Sheet 2 (3 columns) and get corresponding value from Sheet 2 column B - and output to Sheet 1 column A.
My dream - end goal - I need to search Sheets 2, 3, 4, 5 (same 3 cloumns on each sheet) and get corresponding values from Sheets 2, 3, 4, 5 cloumns B and C (LastName, FirstName) and output to Sheet 1 column A.

Any help or pointers in the right direction would be VERY appreciated. Thank you!
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
**Follow-up

So far, the following formula is working most of the way. I can perform what is needed, but searching only 1 sheet for now (will work on searching all 4 sheets).

Also, for some reference, Sheet1 is my main sheet and E2 is the Start Date, F2 is the End Date - for returning values between those 2 dates.
A1 is the text value I am searching for. Using the example in my first post, this would be "Chad".

If anyone can suggest something cleaner, better, more efficient - please feel free to reply. Thanks!

=TOCOL(IF(Sheet2!$A$2:$A$3000>=Sheet1!$E$2,IF(Sheet2!$A$2:$A2000<=Sheet1!$F$2,IF(Sheet2!$G$2:$I$3000=$A$1,Sheet2!$C$2:$C$3000&", "&Sheet2!$D$2:$D$3000,x),x),x),2)
 
Upvote 0
How about
Excel Formula:
=LET(v,VSTACK(Sheet2!A1:H100,Sheet3!A1:H100,Sheet4!A1:H100),TOCOL(IF((TAKE(v,,-3)=A1)*(INDEX(v,,1)>=E2)*(INDEX(v,,1)<=F2),INDEX(v,,3)&", "&INDEX(v,,2),1/0),2))
 
Upvote 0
Solution
How about
Excel Formula:
=LET(v,VSTACK(Sheet2!A1:H100,Sheet3!A1:H100,Sheet4!A1:H100),TOCOL(IF((TAKE(v,,-3)=A1)*(INDEX(v,,1)>=E2)*(INDEX(v,,1)<=F2),INDEX(v,,3)&", "&INDEX(v,,2),1/0),2))

This helps a lot. Thank you. Quick question though. Using my example, searching for "Chad", how can I only search columns F:H in case one of the names in B:C might also contain "Chad"?
 
Upvote 0
It does only search columns F:H ;)
 
Upvote 0
It does only search columns F:H ;)
Well I guess it's pretty clear that I don't understand how exactly it works! (facepalm..) I think I'm going to have to buy a book or something to learn this stuff much better. Again, Thanks for your help!
 
Upvote 0
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,214,636
Messages
6,120,668
Members
448,977
Latest member
moonlight6

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