Quantcast
Channel: Active questions tagged worksheet-function - Super User
Viewing all articles
Browse latest Browse all 1000

-SOLVED- Comparing numerical cell values with an ID against all other cells in rows with the same ID

$
0
0

The title doesn't do the question justice (nor is it very clear). I am trying to program the cells in column J (J5 in screenshot) to display "yes" or "no" based on the following. For reference, here is the current function: =IF(COUNTIFS(B$2:B$23, "Manager", H$2:H$23, "<17")>0, IF(B5="Back-End", VLOOKUP("Back-End", B$2:G$23, 6, FALSE), ""), "N/A")

1. Check the entries in column H using COUNTIFS (nested in an IF function included below) to see how many "Manager" employees will be moved to a new location (they will be moved if Exp >= 17 weeks). If COUNTIFS returns >0 (i.e. employees will be moved), execute the true parameter of IF. Otherwise, display "no" (I have N/A).

2. Given that COUNTIFS > 0, rank the value of Gn (n being 5 in this case, since that's the cell's row) against all the other G-column values that belong to "Back-End" employees.

In other words, since Managers are being moved, John Doe in row 5 is "Back-End", and he has the lowest priority ranking of all "Back-End" employees, John Doe #5's 'Promote' value (J5) should be "Yes"

As you can probably tell, I tried experimenting with VLOOKUP, but that, of course, only returns the first value it finds (hence identical 204.5455 values in column G). COUNTIFS would be useful, but I can only use it to return the number of "Back-End" employees, not a range of cells against which to RANK the Priority value of row 5.

Just to cover all my bases, I have not been able to find any similar problems to this on StackExchange (or anywhere else for that matter). If anything here needs clarification, I'm happy to oblige.

Thanks for any suggestions.

EDIT

I have discovered a solution.

=IF(B4="Back-End", IF(C4<=SMALL(IF(H:H="Back-End", G:G), COUNTIFS($B$2:$B$23, "Manager", $H$2:$H$23, ">=17")), "Yes", "No"), "No")

Example row here is 4. The function checks that the current employee is "Back-End", then checks if his/her priority value is within the x lowest values of "Back-End" employees (determined by SMALL). X here is the number of Managers with >=17 weeks of experience returned by the COUNTIF call.

Cheers.Narondil


Viewing all articles
Browse latest Browse all 1000

Trending Articles