2

I have a worksheet with a few hundred rows of employee data. At its most basic level it lists EmployeeID's, Name and lists the skills that they have.

What I have done is on another worksheet (in my Employee Lookup workbook) I have used a combination of the index and match functions to look up an EmployeeID that I enter and return the skill level from the employee skills data sheet.

What I want to do is try to simplify how the data is obtained (I have limited vba knowledge but some excel formula knowledge, hence nesting index match). The Employee Skills sheet has Column A with EmployeeIDs and Row A with skill names (and prior headers).

I can set up the Index/Match for each row but then I need the column numbers for each skill and look up that EmployeeID and return the skills (even if they are blank).

I wouldn't really bother with trying to figure out how to begin to code this but I would think there would be an easier way to do this than making an Index/Match formula for each referenced skill (with there being anywhere from ~15-50 skills per department when I assist with 4 departments).

The Index/Match functions would take a lot of time and already has for one group. I don't think what I am wanting can be done in Excel but unfortunately that is the data resource I am left with.

Example of spreadsheet layout:

Example of spreadsheet layout

ashleedawg
  • 20,365
  • 9
  • 72
  • 105
jnjustice
  • 83
  • 1
  • 9
  • Welcome to Stack Overflow! I'm having bit of trouble following your explanation. The top of that image is what you have, and the bottom is what you want? – ashleedawg Jan 31 '18 at 02:50
  • ...if so, you shouldn't need need VBA. I believe *one* formula will do the trick; the key is to using the "correct mix" of dynamic & absolute references. In fact, if I understand what you're trying to do, VBA would overcomplicate. – ashleedawg Jan 31 '18 at 02:53
  • @ashleedawg what you are stating is correct, The top is the data sheet and the bottom is my lookup sheet (in another workbook). I would want the skills of Bob (listed top to bottom, as on the look up sheet) if I enter his employee ID in the lookup cell. – jnjustice Jan 31 '18 at 02:59
  • I have the index and nested match functions with appropriate references but maybe I am doing the dynamic and absolute bit wrong as I have to edit the references manually myself :( quite tedious honestly. – jnjustice Jan 31 '18 at 03:00
  • ...so for example, you would enter an employee number in `B9`, and you would want `B12 to B15` to auto-populate? Or would the list of skills `A12 to A15` also need to change depending on the employee? – ashleedawg Jan 31 '18 at 03:05
  • ...so for example, you would enter an employee number in `B9`, and you would want `B12 to B15` to auto-populate? Or would the list of skills `A12 to A15` also need to change depending on the employee?? Also, with correctly written formulas (or VBA), you should only ever have to type something once. :-) – ashleedawg Jan 31 '18 at 03:10
  • @ashleedawg the skills for the department are all the same so they could remain listed in the column even if that employee doesn't have the skill. – jnjustice Jan 31 '18 at 03:11
  • I'll put together an example in a couple mins... – ashleedawg Jan 31 '18 at 03:12
  • @ashleedawg I had the formulas once and the references got deleted and the columns for the skills were referenced and I had to look up each individual lot so it was tedious and I wanted to see how to simplify it. That's what led me here :) – jnjustice Jan 31 '18 at 03:12
  • *individual skill – jnjustice Jan 31 '18 at 03:13
  • VBA definitely has many powerful applications (and you *should* learn it!) but in this case would be more tedious, especially if you're new to VBA. Gimme a couple mins... – ashleedawg Jan 31 '18 at 03:21
  • I appreciate the help a lot, I figured the absolute references would be the way to go but I was unsure how that would affect the columns (but I guess it doesn't) because it's just referencing the cells in the header row. – jnjustice Jan 31 '18 at 03:25
  • np, gets easier with practice – ashleedawg Jan 31 '18 at 03:25

1 Answers1

3

Short Answer:

(A detailed & color-coded screenshot breaking down the formula is further down, or full-screen .PNG here.)

Here's a solution using sample data similar to yours:

screenshot example #1

The "short version" of the formula in D16 is:

=INDEX($C$4:$I$8,MATCH($D$11,$A$4:$A$8,0),MATCH(C16,$C$3:$I$3,0))

The actual formula I used looks scarier but it's just the above formula twice (copy/pasted) along with an IF so that it will bring over a blank cell if the "source cell" is blank (like Jane's Partying score)...

=IF(INDEX($C$4:$I$8,MATCH($D$11,$A$4:$A$8,0),MATCH(C16,$C$3:$I$3,0))=0,"",INDEX($C$4:$I$8,MATCH($D$11,$A$4:$A$8,0),MATCH(C16,$C$3:$I$3,0)))

Once that formula is in D16, I just "filled down" (or copy/paste) to the other skills.

  • Note that all cell references in the above formula are "Absolute" except for C16.

We want all cell ranges to stay the same even if we copy/paste (or fill) the cell to another cell... except for C16: that's what our lookups are based on so that once does need to change when we copy the cell elsewhere.


"Two-dimensional Index/Match" Example:

screenshot example #2

Download .xslx sample file:

To get a better idea of how it works, you can download the Excel file from my screenshot here to experiment, modify, and adapt as desired.

It's a direct-download link to a Macro-free .XSLX, hosted by Jumpshare, which allows you to view online but it doesn't like complex formulae, and the columnar formatting is messed up on some browsers (however you can also download from the online viewer with the DOWNLOAD button at the ↗top-right↗ of the viewer.


INDEX & MATCH Function Documentation & More Examples:


A Crash-Course on Absolute vs. Relative Cell References

Cell Reference — A cell reference refers to a cell or a range of cells on a worksheet and can be used in a formula so that Microsoft Office Excel can find the values or data that you want that formula to calculate. (Source)

By default, a cell reference is relative. For example, when you refer to cell A2 from cell C2, you are actually referring to a cell that is two columns to the left (C minus A), and in the same row (2). A formula that contains a relative cell reference changes as you copy it from one cell to another.

As an example, if you copy the formula =A2+B2 from cell C2 to D2, the formula in D2 adjusts to the right by one column and becomes =B2+C2. If you want to maintain the original cell reference in this example when you copy it, you make the cell reference absolute by preceding the columns (A and B) and row (2) with a dollar sign ($). Then, when you copy the formula =$A$2+$B$2 from C2 to D2, the formula stays exactly the same.

In less frequent cases, you may want to make a cell reference "mixed" by preceding either the column or the row value with a dollar sign to "lock" either the column or the row (for example, $A2 or B$3).

Chart: Compare 4 types of cell references(Source)


>

"Regional Afterthought":

While answering a question about Excel's regional differences, I wondered if $ is the international symbol for Absolute References, or whether the symbol varied "across the pond".

("Will Brexit change "U.K. Absolutes" from =€A€1 to =£A£1?!")

A quick search revealed that the $ is indeed the "worldwide" symbol used for Excel Absolutes — however some users (having never typed a $ before) had trouble locating it. Here's a link describing How to type the $ Dollar Sign on Non-American Keyboards...


Good luck with your project! Let me know if you have any questions...

ashleedawg
  • 20,365
  • 9
  • 72
  • 105
  • @ashleedawg I think part of this is with index match I've only used index to reference one column, where you have $C$4:$I$4 I only had $C:$C (I believe, the remaining formula are on my work computer). So I'll have to dissect that more tomorrow so I know why that array is a better option. – jnjustice Jan 31 '18 at 04:15
  • @jnjustice — Download the `.XLSX` example (direct link **[here](https://storage.jumpshare.com/download/FKdEI1MHFFMcOmklF1ZICsHOZNjatt-lUCuq2WvF1gve3hucf5aC-Ez7HS_xUOtUFsh649UsyeAU1tdvgLCAqg)**) and play with the formulas, and they should make more sense. (You were halfway there on your own!) ...Take note of which sections of each `Index`/`Match` formula are *relative* and which are ***$absolute$*** Let me know if you have any questions. – ashleedawg Jan 31 '18 at 06:22
  • @ashleedawg so I updated the excel sheet with the formula and I get an **#N/A** error. The formula as the data is updated is: `=IF(INDEX($S$2:$BH$1000,MATCH($A$7,$A$2:$A$1000,0),MATCH(A16,$S$1:$BH$1,0))=0,"",INDEX($S$2:$BH$1000,MATCH($A$7,$A$2:$A$1000,0),MATCH(A16,$S$1:$BH$1,0)))` I have updated your numbers from the formula: `Before: $C$4:$I$8 $D$11 $A$4:$A$8 C16 $C$3:$I$3 After: $S$2:$BH$1000 $A$7 $A$2:$A$1000 A16 $S$1:$BH$1` – jnjustice Jan 31 '18 at 14:31
  • When troubleshooting a formula, break it down into smaller formulas to see what result you get from each part. Your formula is `=MATCH($A$7,$A$2:$A$1000,0)` (looking in `A2:A1000` to find an exact match for the value in `A7`) **and** `=MATCH(A16,$S$1:$BH$1,0)` (looking in `S1:BH1` to find an exact maych for the value in `A16`.) Is that what you intended? What do you get when you enter one of those two formulas into a cell by itself? (**Notice** that I left off the `IF` formula for now, for troubleshooting.) – ashleedawg Jan 31 '18 at 15:41
  • ...and then if you still can't find the mistake, tell me what value is in cells 'A7` and `A16`, and which "position" in each range you find those values. – ashleedawg Jan 31 '18 at 15:42
  • @jnjustice — Did you get it figured out? – ashleedawg Feb 01 '18 at 11:15
  • I did not see your reply until today and I will check again at work tomorrow when have access to the data. @ashleedawg – jnjustice Feb 02 '18 at 03:45
  • @ashleedawg there was no error with the formula, I had the wrong reference conlumn for the employee ID to look up. The formula itself will say me a lot of time because I was not looking things up based on the skill name in the look up sheet but now if I update those it will save a lot of time (where as before if the columns changed I would have to adjust manually) – jnjustice Feb 02 '18 at 13:57