Link to home
Start Free TrialLog in
Avatar of mcthomas00
mcthomas00

asked on

Excel Matrix

I have an excel matrix workbook with 5 sheets and a roll up sheet.  
 
In column A you put a ranking of +1 to +5 for each Criteria.  Then in B, C, & D you’d do the same.  I want a ranking scale of +1-+5 and I want to eliminate repeats.  So if you enter +1 in A for Criteria 1 you can’t use +1 again in B, C &D for Criteria 1.  It forces you to use only those numbers that are left.  So B could be any of the remaining numbers +2-+5 but not +1 for Criteria 1.  Once you select B (say +4) now C could only be +2, +3 & +5 for Criteria 1.  Each Criteria would be set up the same with a ranking scale available +1-+5.  So each row is independent.
 
The other challenge is that this would have to be done over the 5 sheets.  So each Column A is a separate sheet with the 4 rows of Criteria and the rule or formula would have to work across the separate sheets.  So on the Sheet for Column B it would have to know that for Criteria 1 +1 was used on sheet 1 (column A) and not available to select.
excel-matrix.xlsx
Avatar of Flyster
Flyster
Flag of United States of America image

See if this meets your requirements. It uses Data Validation. Starting on Sheet1, G2, this formula is used:

=(G2>0) * (G2<6) * (COUNTIF($G2:$J2,G2)=1) * (G2<>Sheet2!G2) * (G2<>Sheet3!G2) * (G2<>Sheet4!G2) * (G2<>Sheet5!G2)

It allows only numbers greater than 0 and less than 6. The cells are formatted as numbers with zero decimal places, in case someone wants to enter something like 1.4. In that case, it will just appear as a 1. The formula then checks the other 4 sheets to see if that number exists elswhere. If it does, an error message will appear prompting for a different number.

Flyster
excel-matrix.xlsx
Avatar of mcthomas00
mcthomas00

ASKER

Where would I enter the above formula
I re-read the answer, I would enter the formula in the Data Validation.  
I tested entering information in the cells.  The formula is only checking duplicate cells on the same sheet, not across the 5 sheets.  Ex.  I can enter the #5 on sheet 1, but cannot enter #5 on sheet one again, but I can enter the #5 on another sheet.  I need the error to appear if that value appear in Criteria 1 on all 5 sheets.
Also noticed after further experimenting.  The formula does check to see if the value is on one of the 5 sheets, but it is checking to see if the value has been added to the  same cell on the previous sheets.  I need it to check all 5 sheets an any of the cells for that criteria no matter which cell the value was entered
If I'm understanding you correctly, you want the numbers 1-5 to appear only once among the 5 sheets. So if Sheet1 has 1,2,3,4 in A-D, 5 can only appear on 1 of the remaining sheets. If that's the case, this formula should work:

=(G2>0) * (G2<6) * (COUNTIF($G2:$J2,G2)=1) * (COUNTIF(Sheet2!$G2:$J2,G2)=0) * (COUNTIF(Sheet3!$G2:$J2,G2)=0) * (COUNTIF(Sheet4!$G2:$J2,G2)=0) * (COUNTIF(Sheet5!$G2:$J2,G2)=0)

Note: This formula is for Sheet1. For Sheet2 you would change "(COUNTIF(Sheet2!$G2:$J2,G2)=0)" to "(COUNTIF(Sheet1!$G2:$J2,G2)=0)"
1.  So on sheet 1 replace the formula in all cells to the above with the exception of changing the cell reference.

2.  For sheet to you said to change only where it reference Sheet 2.  What would sheet 3, 4 and 5 be changed to.
ASKER CERTIFIED SOLUTION
Avatar of Flyster
Flyster
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thank you it works!  Can you explain what the formula is telling me.  I understand the >0 and <6 as the results within that range.
Awesome work!
=(G2>=1) * (G2<6) : This assures that only 1 through 5 is entered. As I mentioned above, the cells are formatted as numbers with no decimal places, so if someone entered 5.9 it would show up as a 5, and is still less than 6. The >=1 means that 1 is the lowest value allowed.

(COUNTIF($G2:$J2,G2)=1) : It takes the range, in this case $G2:$J2 and looks for the count value, the value in G2. When you first enter a number into the range, say 1, COUNTIF counts the number of times 1 appears. So for the first time the count would be 1. If you try to enter it again, in the same range, the count would be 2, which does not equal 1 which violates the validation rule.

(COUNTIF(Sheet2!$G2:$J2,G2)=0) : This looks at sheet2, $G2:$J2 and counts the number of times the above value (1) appears. If there's a 1 here, it would mean the count is 1 and therfore violates the "=0" rule. The same is for the other three sheets.

Let me know if you have any other questions. I'm glad to help! :)
Thank you for the explanation.  One more question, you used * to separate.  Reason
The multiply operator (*) is used to get numeric value of the criteria. Data validation is met when there's a value of 1 (True). If you have three criteria's and they're all true, then you have 1*1*1 which equals 1. If one of them was 0 (False) then the total result would be 0. 1*0*1 equals 0.
THank you