Retrieving Data from Multiple Sheets on Matching Criteria

reberryjr

Well-known Member
Joined
Mar 16, 2017
Messages
701
Office Version
  1. 365
Platform
  1. Windows
I'm in need of some assistance with a task I'm trying to complete. I have a sheet called "Client Summary", where I'm trying to pull in data from several other sheets where the "Client ID" matches on each sheet. Depending upon the sheet I'm hitting, it could be a 1:1 or 1:many search. Here are a couple of examples:

I would expect to see "Tommy" in the Nickname field of the Client Summary sheet, and -5.00 in the Weight Change field, from the Stats sheet. Note that on the Stat sheet, there are multiple rows for the Client ID.
Client Summary Sheet
TodayUpdatedStatusClient IDNameNicknameWeight Change
TJ1

<colgroup><col><col><col><col><col><col></colgroup><tbody>
</tbody>

Bios Sheet
TodayUpdatedStatusKeyClient IDFirstLastSuffixNameNickname
01/12/1801/12/18Active1TJ1TomJonesSr.Tom Jones Sr.Tommy
01/12/1801/12/18Active2ND2NancyDrewNancy DrewNancy Drew

<colgroup><col span="2"><col><col><col><col><col><col><col><col></colgroup><tbody>
</tbody>

Stats Sheet
TodayUpdatedClient IDNameEntry TypeHeightWeightWeight Change
01/12/1801/12/18ND2Nancy DrewInitial5'5"125.000.00
01/12/1801/11/18TJ1Tom Jones Sr.Initial5'11"175.0050.00
01/12/1801/12/18TJ1Tom Jones Sr.Update5'11"170.00-5.00

<colgroup><col span="2"><col><col><col><col><col><col></colgroup><tbody>
</tbody>

I was hoping to enter a formula via a macro that runs when a Client is entered.

Any suggestions?
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
Copy and paste this macro into the worksheet code module. Do the following: right click the tab for your "Client Summary" sheet and click 'View Code'. Paste the macro into the empty code window that opens up. Close the code window to return to your sheet. Enter a Client ID in column D and exit the cell.
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    If Intersect(Target, Range("D:D")) Is Nothing Then Exit Sub
    Application.ScreenUpdating = False
    Dim LastRow As Long
    LastRow = Cells.Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
    Dim foundId As Range
    Set foundId = Sheets("Bios").Range("E:E").Find(Target, LookIn:=xlValues, lookAt:=xlWhole)
    If Not foundId Is Nothing Then
        Target.Offset(0, 2) = foundId.Offset(0, 5)
    Else
        MsgBox ("Client ID not found in Bios sheet.")
    End If
    Set foundId = Sheets("Stats").Range("C:C").Find(What:=Target, LookIn:=xlValues, lookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlPrevious, MatchCase:=False)
    If Not foundId Is Nothing Then
        Target.Offset(0, 3) = foundId.Offset(0, 5)
    Else
        MsgBox ("Client ID not found in Stats sheet.")
    End If
    Application.ScreenUpdating = True
End Sub
 
Upvote 0
@mumps, this is really cool, but I don't think it gives me what I need. I'm looking for something that's going to continuously update as the data in the other sheets evolves. I'll be searching for MAX and MIN values on some sheets, and a dynamic amount of sheets.

However, this seems to be a bit cleaner than a bunch of Index/Match/Min/Max formulas (that I'm struggling to create).

I'm heading to the gym soon, but I'm going to see if I can fiddle with this code to replace the formulas. I'm thinking that for max and min, maybe I could declare row names and then leverage that in the code. Not sure though.

I very much appreciate the response!!!
 
Upvote 0
Would this seem like a road I should travel down when I get back?

I'm thinking that for max and min, maybe I could declare row names and then leverage that in the code
 
Upvote 0
Without seeing your workbook and not knowing exactly what you want to do, it's difficult to tell what the best approach would be. It is always easier to help and test possible solutions if we could work with your actual file. Perhaps you could upload a copy of your file to a free site such as www.box.com. or www.dropbox.com. Once you do that, mark it for 'Sharing' and you will be given a link to the file that you can post here. Include a detailed explanation of what you would like to do referring to specific cells and worksheets. If the workbook contains confidential information, you could replace it with generic data.
 
Upvote 0
@mumps I uploaded a copy to Box. The general idea is that as new clients are on-boarded, they get their own worksheet, named after their assigned unique Client ID (this is what I'm using to match everything on). While their individual worksheets will track details about the services they've signed up for, different stats are tracked on the Stats sheet (everyone is combined here). The EU isn't overly computer literate, so I want to prevent them from having to touch a lot of data, outside of userforms. The Client Summary sheet is what the EU will be able to play with the most. With that being said, I want to bring over the truly key elements that the EU will review the most, onto this sheet. I haven't fully planned out another step yet (because I don't truly know the capabilities of VBA), but I might use the Client Summary sheet and/or other sheets to drive some charts and/or pivots.

I'm happy to research paths and revert if I'm unable to figure something out. I just don't know what the path is. Hopefully that makes sense.

https://app.box.com/s/xmn52r728tq5gwu7xrzpe9az6qk0s6j6
 
Upvote 0
It is difficult to follow what you want to do because you have many userforms and many controls with a code attached to each one. I'm not sure that I can help at this point but if it's possible for you to take me through the process, step-by-step, using one example of a new client being added, I will have a look to see if I can help in any way.
 
Upvote 0

Forum statistics

Threads
1,215,004
Messages
6,122,656
Members
449,091
Latest member
peppernaut

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