+ Reply to Thread
Results 1 to 12 of 12

Cross Referencing With More Than One Variable?

  1. #1
    Registered User
    Join Date
    12-17-2013
    Location
    Leeds, England
    MS-Off Ver
    Excel 2007
    Posts
    11

    Cross Referencing With More Than One Variable?

    Hi guys

    Firstly, could anyone let me know if what I'm trying to achieve is possible? And if so could you help advise what method or formulas I could use. Any suggestions at all would be appreciated!

    I've attached a copy of the spreadsheet I'm working on. I'm struggling to work out the best way to get the information in column G ('No. of fully compliant staff') located in the 'No. of Comp Staff by Location' worksheet.

    Columns A:C in the 'Testing Method 1' worksheet is the raw data. Columns D onward in this tab are what I've done so far in hopes of finding an easier way to get the result but I think it's a dead-end really.

    It's only a problem because in the raw data we have the 'employee number' each time they complete a course. Perhaps I should start by trying to get all data relating to that employee onto one row? Is there a formula for this?

    Sorry it's not the easiest question in the world but I'm really struggling!

    Again any help would be appreciated.

    Cheers

    Harry
    Attached Files Attached Files

  2. #2
    Forum Expert GeneralDisarray's Avatar
    Join Date
    09-15-2011
    Location
    Pittsburgh, PA, USA
    MS-Off Ver
    Windows Excel 2016
    Posts
    1,416

    Re: Cross Referencing With More Than One Variable?

    Does 'fully compliant' just mean, they have taken every course? Also, I assume you know the number of courses?


    Also, on one tab you have Employee - on the Other Location - is there a table somewhere we are missing that connects people and the locations?
    Last edited by GeneralDisarray; 08-05-2015 at 10:27 AM.
    Remember, saying thanks only takes a second or two. Click the star icon(*) below the post you liked, to give some Rep if you think an answer deserves it.

    Please,mark your thread [SOLVED] if you received your answer.

  3. #3
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,333

    Re: Cross Referencing With More Than One Variable?

    Hi Harry,

    If your data was arranged better you could do a Pivot Table to get an answer. I've created a macro to change these types of "Crosstab Tables" into better Excel type tables. I've included my macro in the attached and run it on Sheet 1 data, which gets it to Sheet 2 table. Then a Pivot is done on the Sheet 2 data and your answer is there. I think this is what you want.
    Attached Files Attached Files
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  4. #4
    Registered User
    Join Date
    12-17-2013
    Location
    Leeds, England
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: Cross Referencing With More Than One Variable?

    Hi,

    Thanks for responding so quickly! And sorry for not being clear - 'Fully Compliant' just means that they have completed all of the required courses between B:N that have a 'yes' in the column. Any of the blank cells in columns B:N just mean that they do not need to complete the courses in the particular column heading to be compliant.

    There isn't anything to link each employee to each location I'm afraid. They kind of link to every single location in a way. I need to find out exactly how many employees are at the least compliant with that location, depending on whether they have completed all of the courses with a 'yes' on that particular row. So each employee may potentially be counted more than once in the figures, but that's ok, as they can be compliant to work at more than one location.

    Hope that makes sense?

    Many thanks

    Harry

  5. #5
    Registered User
    Join Date
    12-17-2013
    Location
    Leeds, England
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: Cross Referencing With More Than One Variable?

    Sorry Marvin - I spent so long writing that post that I didn't see yours! I will check it out now .

    Thanks for helping. Cheers, Harry

  6. #6
    Forum Expert GeneralDisarray's Avatar
    Join Date
    09-15-2011
    Location
    Pittsburgh, PA, USA
    MS-Off Ver
    Windows Excel 2016
    Posts
    1,416

    Re: Cross Referencing With More Than One Variable?

    Just as an alternative.

    I think you could:
    ** Add a column to 'Testing Method 1' to combining Columns A, B and C (to create a kind of key).
    ** Add a column to check "does this row indicate a unique, completed course for this employee?"
    Please Login or Register  to view this content.
    **You will need a Staff-To-Location table (which I made up and added) on sheet 3.

    **After that you, add a 'Score' table to count how many courses were completed for each employee on the 'Testing Method' tab - finally you deem them 'fully compliant if this score equals 13.

    Back on the first tab, you just sumif() on this table (see attachment).


    Just adding this as an alternative example, I like pivots like Marvin's post
    Attached Files Attached Files
    Last edited by GeneralDisarray; 08-05-2015 at 11:02 AM.

  7. #7
    Registered User
    Join Date
    12-17-2013
    Location
    Leeds, England
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: Cross Referencing With More Than One Variable?

    Hi both,

    Thank you for your suggestions so far!

    Marvin - I ran your macro and entered '3' for the number of fixed columns. The first part worked and it restructured my columns, but I don't seem to get the 'Sheet 2 Table' and the 'Value' column is empty. I've attached what my data looks like after running the macro (saved in a different format due to size limit). I've looked at the macro workbook that you sent and I've never really used pivot tables before but it looks like they might come in handy. However, am I right in thinking that it the pivot table is only useful to find out how compliant each member of staff is compared to how compliant they should be (completed all 13 courses), as oppose to how many staff are compliant enough to work at say 'Location 1' in the first worksheet?

    For example, for 1 member of staff to be compliant enough to work at Location 1 they need to have at least completed courses 2, 3, 4, 5, 6, 7, 8, 10 ,11, 12 and 13. Then they would count as 1 person being compliant. So what I need to do is find out, out of all the staff in the data, how many have at least completed courses 2,3,4,5,6,7,8,10,11,12 and 13, and then total that in the first worksheet in cell 'O2'. Then I need to do the same for Location 2, in which a person must have completed courses 1,2,4,5,6,7,8,10,11,12 and 13 to be compliant, then total this and enter in cell 'O3'.

    Sorry, I'm not very good with pivot tables. Would I be able to display this information using various filters? Thanks!

    GeneralDissarray - Thanks also for providing your method. I usually do the same thing with the 'unique key' (but I use =COUNTIF to check the 'uniqueness'). There shouldn't be any duplicate records. It must have been a manual error when I was setting up the example data!

    I'm looking at the Staff->Location table and it looks good but I'm not sure if I have the same problem as I had with Marvin's suggestion? Is your table giving me how many people have completed enough courses in total (not which courses specifically) and then matching this to like a number figure for that location, as oppose to the specific group of courses someone needs to complete to be compliant for that location?

    Don't worry if this is seeming unlikely to find a solution to. I did it manually last time, it just takes a while to do that's all .

    Thanks again!

    Harry
    Attached Files Attached Files
    Last edited by Harry Sowden; 08-07-2015 at 08:38 AM.

  8. #8
    Forum Expert GeneralDisarray's Avatar
    Join Date
    09-15-2011
    Location
    Pittsburgh, PA, USA
    MS-Off Ver
    Windows Excel 2016
    Posts
    1,416

    Re: Cross Referencing With More Than One Variable?

    Quote Originally Posted by Harry Sowden View Post
    Hi both,
    Is your table giving me how many people have completed enough courses in total (not which courses specifically) and then matching this to like a number figure for that location, as oppose to the specific group of courses someone needs to complete to be compliant for that location?.
    Yes: it is.

    It would be possible to do what you explain (determine who is compliant for a location). But, we would then need to know what each location requires for compliance.

    I think that would actually be easier to deal with, but can you get a table with that information?

  9. #9
    Registered User
    Join Date
    12-17-2013
    Location
    Leeds, England
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: Cross Referencing With More Than One Variable?

    Hi,

    Sorry for maybe not been clear enough originally. In the original spreadsheet (that I attached to the first post) - in the first worksheet ('No. of Comp Staff by Location') - the chart there. For someone to be fully compliant for that location they need to have completed all the courses with a 'yes' in that cell. Each 'yes' means that it's mandatory that that course is complete as well as all the other yes's in that row in order to be compliant for to work at that location.

    I'd guess there is a way of using multiple IFs and LOOKUPs?

    Hope this makes sense? Let me know if the table needs reformatting and I can work something out to make it easier to read.

    Many thanks
    Last edited by Harry Sowden; 08-07-2015 at 11:09 AM.

  10. #10
    Forum Expert GeneralDisarray's Avatar
    Join Date
    09-15-2011
    Location
    Pittsburgh, PA, USA
    MS-Off Ver
    Windows Excel 2016
    Posts
    1,416

    Re: Cross Referencing With More Than One Variable?

    EDIT: Original attachment had a formula error -see FIXED copy currently attached.

    Ok. I think I got it for you - I had to change the file format to upload it (.xlsx is a compressed format) - it was too large as a .xls file


    Here's what I did.

    I Created a tab call "EMPLOYEE RESULTS CODED" - that list each employee once. Next to the Employee ID: you will see 13 columns of 1's or 0's - this tells you which courses the employee has passed. 1 = have completed this course, 0 = have not. After those columns you will see a bunch of "TRUE" & "FALSE" values for each location (for the next 83 columns).

    That tells you if a given employee is compliant for a given location.



    Back on your "No. of Comp Staff by Location" tab - you'll see the counts for each location (counts the "trues" from the other tab).

    Please have a look, this one took some noodling
    Attached Files Attached Files
    Last edited by GeneralDisarray; 08-07-2015 at 11:46 AM.

  11. #11
    Registered User
    Join Date
    12-17-2013
    Location
    Leeds, England
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: Cross Referencing With More Than One Variable?

    Hi GeneralDisarray

    What you've done there looks amazing! The formulas look quite complicated but I'm looking at how the SUMIF formula works now so I should be able to understand it. I'll try figure it out and use it on my real data and let you know if I have any issues. I'll mark this thread as completed or solved or whatever it is for now.

    I'm very impressed with this perfect solution!

    Thanks again!

    Harry

  12. #12
    Forum Expert GeneralDisarray's Avatar
    Join Date
    09-15-2011
    Location
    Pittsburgh, PA, USA
    MS-Off Ver
    Windows Excel 2016
    Posts
    1,416

    Re: Cross Referencing With More Than One Variable?

    Thank you- glad to be of help This was an interesting problem.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Cross Referencing -
    By Amolvijay in forum Excel General
    Replies: 2
    Last Post: 08-03-2013, 11:01 PM
  2. Cross-referencing and Looking Up
    By mlewis1211 in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 04-29-2010, 10:28 AM
  3. [SOLVED] cross referencing
    By Phil in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 03:05 PM
  4. cross referencing
    By Phil in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 12:05 PM
  5. [SOLVED] cross referencing
    By Phil in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 10:05 AM
  6. cross referencing
    By Roger Govier in forum Excel Formulas & Functions
    Replies: 18
    Last Post: 09-06-2005, 04:05 AM
  7. [SOLVED] cross referencing
    By Phil in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-05-2005, 10:05 PM
  8. cross referencing
    By Phil in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 08-02-2005, 02:05 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1