Home

Inputting data to correlate with a date

%3CLINGO-SUB%20id%3D%22lingo-sub-744529%22%20slang%3D%22en-US%22%3EInputting%20data%20to%20correlate%20with%20a%20date%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-744529%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20all%2C%3C%2FP%3E%3CP%3EI%20am%20trying%20to%20learn%20Excel%20as%20I%20go%20along%20so%20please%20feel%20free%20to%20tell%20me%20if%20there%20is%20a%20better%20way%20to%20achieve%20what%20I%20am%20doing.%3C%2FP%3E%3CP%3EI%20have%20a%20master%20tab%20showing%20dates%20along%20the%20top%20and%20names%20down%20the%20left%20hand%20side.%20When%20I%20click%20a%20name%20it%20hyperlinks%20to%20that%20individual's%20tab%20where%20he%2Fshe%20answers%20several%20questions.%20There%20is%20a%20formula%20to%20turn%20all%20of%20these%20answers%20into%20a%20single%20result%2C%20which%20I%20would%20like%20to%20display%20on%20the%20master%20tab%20to%20correlate%20against%20the%20individual's%20name%20and%20that%20day's%20date.%3C%2FP%3E%3CP%3EI%20don't%20think%20I%20can%20just%20use%20%3D!(name)C4%20for%20example%2C%20as%20that%20tab%20will%20be%20opened%20again%20and%20different%20answers%20given%20on%20subsequent%20days%20-%20i%20need%20the%20result%20to%20be%20pushed%20to%20the%20master%20tab.%20Is%20that%20possible%20or%20is%20there%20another%20way%20that%20I%20need%20to%20be%20looking%20at%20this%3F%3C%2FP%3E%3CP%3EIdeally%20any%20solution%20should%20be%20Excel%202010%20compatible!%3C%2FP%3E%3CP%3EMany%20thanks%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-744529%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-746640%22%20slang%3D%22en-US%22%3ERe%3A%20Inputting%20data%20to%20correlate%20with%20a%20date%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-746640%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F373272%22%20target%3D%22_blank%22%3E%40Dirk_gently25%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20am%20guessing%20that%20Joe%20Blow's%20tab%20is%20named%20Joe%20Blow.%20If%20you%20want%20a%20cell%20on%20the%20master%20worksheet%20to%20show%20the%20results%20for%20Joe%20Blow%20on%20a%20certain%20date%2C%20you%20can%20use%20the%20INDIRECT%20function%20to%20build%20the%20reference%20on%20the%20fly.%20The%20INDIRECT%20function%20lets%20you%20build%20the%20formula%20pointing%20to%20a%20cell%20(or%20range)%20as%20text.%20INDIRECT%20then%20returns%20the%20value%20from%20that%20target%20cell.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ELet's%20suppose%20that%20you%20want%20to%20return%20a%20value%20from%20Joe%20Blow's%20cell%20C4%20today%2C%20D4%20tomorrow%20and%20E4%20the%20day%20after%20that.%20If%20Joe%20Blow's%20name%20appears%20in%20Master%20cell%20A2%2C%20you%20could%20copy%20across%20and%20down%20a%20formula%20like%3A%3C%2FP%3E%3CP%3E%3DINDIRECT(%22'%22%20%26amp%3B%20%24A2%20%26amp%3B%20%22'!%22%20%26amp%3B%20CELL(%22address%22%2CC%244))%20%26amp%3B%20%22%22%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20formula%20concatenates%20an%20empty%20string%20in%20case%20Joe%20Blow's%20cell%20C4%20is%20empty.%20Without%20the%20%26amp%3B%20%22%22%20at%20the%20end%2C%20the%20formula%20would%20return%200%20if%20the%20target%20cell%20were%20empty.%20Potentially%20offsetting%20that%20good%20feature%2C%20concatenating%20an%20empty%20string%20will%20turn%20a%20number%20into%20text%20that%20looks%20like%20that%20number--so%20the%20trick%20is%20best%20to%20use%20when%20you%20know%20cell%20C4%20will%20either%20contain%20text%20or%20be%20blank.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-748428%22%20slang%3D%22en-US%22%3ERe%3A%20Inputting%20data%20to%20correlate%20with%20a%20date%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-748428%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F23287%22%20target%3D%22_blank%22%3E%40Brad%20Yundt%3C%2FA%3E%26nbsp%3BI%20think%20I%20understand%20what%20you%20mean%2C%20but%20unless%20I%20am%20mistaken%20I%20don't%20think%20that%20will%20help%20me%20the%20way%20I%20have%20the%20spreadsheet%20set%20up.%20I'll%20try%20to%20use%20a%20better%20example.%3CBR%20%2F%3E%26nbsp%3BDate%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B1%202%203%204%205%206%207%208%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAlan%3C%2FP%3E%3CP%3EBob%3C%2FP%3E%3CP%3EChris%3C%2FP%3E%3CP%3EDavid%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20way%20I%20have%20it%20set%20up%2C%20Alan%20would%20click%20on%20his%20name%20today%20(the%201st%20of%20the%20month)%2C%20which%20would%20hyperlink%20to%20a%20simple%20list%20of%20questions.%20These%20questions%20would%20result%20in%20a%20single%20digit%20overall%20%22score%22%20for%20that%20day.%20That%20score%20would%20populate%20under%201%20just%20using%20the%20%22%3D!AlanC5%22%20for%20example.%20This%20all%20works%20fine.%20The%20problem%20comes%20when%20tomorrow%20Alan%20clicks%20his%20name%20and%20gets%20the%20same%20set%20of%20questions%2C%20but%20potentially%20resulting%20in%20a%20different%20overall%20%22score%22%20-%20how%20do%20I%20get%20the%20master%20document%20(shown%20above)%20to%20put%20the%20new%20score%20in%20box%202%20and%20not%20change%20box%201%3F%3C%2FP%3E%3CP%3EHope%20that%20all%20makes%20sense!%20I%20am%20happy%20to%20link%20what%20I%20have%20created%20so%20far%20if%20that%20helps.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-748544%22%20slang%3D%22en-US%22%3ERe%3A%20Inputting%20data%20to%20correlate%20with%20a%20date%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-748544%22%20slang%3D%22en-US%22%3EI%E2%80%99m%20so%20sorry%20to%20inform%20you%20that%20no%20amount%20or%20quality%20of%20explanation%20would%20equal%20the%20clarity%20of%20a%20sample%20file.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-750000%22%20slang%3D%22en-US%22%3ERe%3A%20Inputting%20data%20to%20correlate%20with%20a%20date%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-750000%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F280482%22%20target%3D%22_blank%22%3E%40Twifoo%3C%2FA%3E%26nbsp%3BPlease%20see%20attached%20file.%20This%20is%20an%20early%20work%20in%20progress%20to%20show%20the%20current%20problem.%20All%20I%20would%20like%20to%20demonstrate%20is%20Alan%20logging%20in%20today%20and%20filling%20out%20his%20information%2C%20this%20should%20be%20saved%20under%20the%20correct%20date%20in%20the%20master%20tab.%20When%20Alan%20logs%20in%20again%20tomorrow%2C%20the%20data%20should%20be%20saved%20under%20the%20new%20date%20but%20the%20old%20data%2Fdate%20should%20not%20be%20changed.%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-751615%22%20slang%3D%22en-US%22%3ERe%3A%20Inputting%20data%20to%20correlate%20with%20a%20date%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-751615%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F373272%22%20target%3D%22_blank%22%3E%40Dirk_gently25%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3ETo%20achieve%20your%20desired%20results%2C%20you%20need%20VBA%2C%20which%20is%20not%20my%20forte.%20Certainly%2C%20the%20other%20experts%20here%20can%20help%20you%20with%20that.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-752990%22%20slang%3D%22en-US%22%3ERe%3A%20Inputting%20data%20to%20correlate%20with%20a%20date%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-752990%22%20slang%3D%22en-US%22%3E%3CP%3EHere%20is%20a%20macro%20that%20will%20track%20entries%20made%20in%20C4%3AC9%20in%20the%20various%20worksheets%2C%20and%20will%20report%20the%20fatigue%20score%20to%20the%20appropriate%20date%20for%20that%20person%20on%20the%20Master%20worksheet.%20Because%20the%20code%20is%20not%20putting%20a%20formula%20in%20the%20cell%2C%20the%20scores%20will%20be%20retained%20as%20time%20goes%20on.%20The%20code%20must%20be%20installed%20in%20ThisWorkbook%20code%20pane.%20Also%2C%20you%20must%20save%20the%20workbook%20with%20.xls%2C%20.xlsm%20or%20.xlsb%20file%20extension%20(.xlsx%20will%20remove%20the%20code).%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20code%20is%20%3CEM%3Enot%3C%2FEM%3Elooking%20for%20the%20green%20column%20to%20enter%20the%20data.%20Instead%2C%20it%20is%20matching%20the%20date%20from%20Alan's%20cell%20C1%20with%20the%20dates%20in%20Master%20row%203.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3E'Put%20this%20code%20in%20ThisWorkbook%20code%20pane.%20It%20won't%20work%20at%20all%20if%20installed%20anywhere%20else!%0APrivate%20Sub%20Workbook_SheetChange(ByVal%20Sh%20As%20Object%2C%20ByVal%20Target%20As%20Range)%0ADim%20cel%20As%20Range%2C%20targ%20As%20Range%0ADim%20i%20As%20Long%2C%20j%20As%20Long%0ASelect%20Case%20Sh.Name%0ACase%20%22Splash%20Screen%22%2C%20%22Master%22%2C%20%22DPGs%22%20%20%20%20%20%20'Ignore%20these%20worksheets%0ACase%20Else%0A%20%20%20%20Set%20targ%20%3D%20Sh.Range(%22C4%3AC9%22)%20%20%20%20%20%20'Watch%20these%20cells%20for%20changes%0A%20%20%20%20Set%20targ%20%3D%20Intersect(targ%2C%20Target)%0A%20%20%20%20If%20Not%20targ%20Is%20Nothing%20Then%0A%20%20%20%20%20%20%20%20Application.EnableEvents%20%3D%20False%0A%20%20%20%20%20%20%20%20With%20Worksheets(%22Master%22)%0A%20%20%20%20%20%20%20%20%20%20%20%20i%20%3D%20Application.Match(Sh.Name%2C%20.Columns(1)%2C%200)%0A%20%20%20%20%20%20%20%20%20%20%20%20j%20%3D%20Application.Match(Sh.Range(%22C1%22)%2C%20.Rows(3)%2C%200)%0A%20%20%20%20%20%20%20%20%20%20%20%20.Cells(i%2C%20j).Value%20%3D%20Sh.Range(%22C15%22).Value%0A%20%20%20%20%20%20%20%20End%20With%0A%20%20%20%20%20%20%20%20Application.EnableEvents%20%3D%20True%0A%20%20%20%20End%20If%0AEnd%20Select%0AEnd%20Sub%3C%2FPRE%3E%3C%2FLINGO-BODY%3E
Dirk_gently25
New Contributor

Hi all,

I am trying to learn Excel as I go along so please feel free to tell me if there is a better way to achieve what I am doing.

I have a master tab showing dates along the top and names down the left hand side. When I click a name it hyperlinks to that individual's tab where he/she answers several questions. There is a formula to turn all of these answers into a single result, which I would like to display on the master tab to correlate against the individual's name and that day's date.

I don't think I can just use =!(name)C4 for example, as that tab will be opened again and different answers given on subsequent days - i need the result to be pushed to the master tab. Is that possible or is there another way that I need to be looking at this?

Ideally any solution should be Excel 2010 compatible!

Many thanks

6 Replies

@Dirk_gently25 

I am guessing that Joe Blow's tab is named Joe Blow. If you want a cell on the master worksheet to show the results for Joe Blow on a certain date, you can use the INDIRECT function to build the reference on the fly. The INDIRECT function lets you build the formula pointing to a cell (or range) as text. INDIRECT then returns the value from that target cell.

 

Let's suppose that you want to return a value from Joe Blow's cell C4 today, D4 tomorrow and E4 the day after that. If Joe Blow's name appears in Master cell A2, you could copy across and down a formula like:

=INDIRECT("'" & $A2 & "'!" & CELL("address",C$4)) & ""

 

The formula concatenates an empty string in case Joe Blow's cell C4 is empty. Without the & "" at the end, the formula would return 0 if the target cell were empty. Potentially offsetting that good feature, concatenating an empty string will turn a number into text that looks like that number--so the trick is best to use when you know cell C4 will either contain text or be blank.

@Brad Yundt I think I understand what you mean, but unless I am mistaken I don't think that will help me the way I have the spreadsheet set up. I'll try to use a better example.
 Date                 1 2 3 4 5 6 7 8

 

Alan

Bob

Chris

David

 

The way I have it set up, Alan would click on his name today (the 1st of the month), which would hyperlink to a simple list of questions. These questions would result in a single digit overall "score" for that day. That score would populate under 1 just using the "=!AlanC5" for example. This all works fine. The problem comes when tomorrow Alan clicks his name and gets the same set of questions, but potentially resulting in a different overall "score" - how do I get the master document (shown above) to put the new score in box 2 and not change box 1?

Hope that all makes sense! I am happy to link what I have created so far if that helps.

I’m so sorry to inform you that no amount or quality of explanation would equal the clarity of a sample file.

@Twifoo Please see attached file. This is an early work in progress to show the current problem. All I would like to demonstrate is Alan logging in today and filling out his information, this should be saved under the correct date in the master tab. When Alan logs in again tomorrow, the data should be saved under the new date but the old data/date should not be changed. 

@Dirk_gently25 

To achieve your desired results, you need VBA, which is not my forte. Certainly, the other experts here can help you with that.

Here is a macro that will track entries made in C4:C9 in the various worksheets, and will report the fatigue score to the appropriate date for that person on the Master worksheet. Because the code is not putting a formula in the cell, the scores will be retained as time goes on. The code must be installed in ThisWorkbook code pane. Also, you must save the workbook with .xls, .xlsm or .xlsb file extension (.xlsx will remove the code).

 

The code is not looking for the green column to enter the data. Instead, it is matching the date from Alan's cell C1 with the dates in Master row 3.

 

'Put this code in ThisWorkbook code pane. It won't work at all if installed anywhere else!
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
Dim cel As Range, targ As Range
Dim i As Long, j As Long
Select Case Sh.Name
Case "Splash Screen", "Master", "DPGs"      'Ignore these worksheets
Case Else
    Set targ = Sh.Range("C4:C9")      'Watch these cells for changes
    Set targ = Intersect(targ, Target)
    If Not targ Is Nothing Then
        Application.EnableEvents = False
        With Worksheets("Master")
            i = Application.Match(Sh.Name, .Columns(1), 0)
            j = Application.Match(Sh.Range("C1"), .Rows(3), 0)
            .Cells(i, j).Value = Sh.Range("C15").Value
        End With
        Application.EnableEvents = True
    End If
End Select
End Sub