Highlight closest cell value in a table - excel

I have a salary data table called SalaryDataTbl and to the right of it a selector where you can choose an employee in cell K2. L2 looks up their discipline and M2 looks up their salary.
Is there a way I can highlight the closest salary for their discipline in the SalaryDataTbl using an in cell function or data validation? Or is this going to require a VBA solution?
In the example in the image, for the salary of 3750 and discipline programming it should highlight cell G2.
EDIT New Sample Data exhibiting bug when salary is 65000 and using formula =AND(ABS(D2-$M$2)=MIN(ABS(DROP(D:I, 1)-$M$2)), $A2=$L$2)
Discipline
Level
Role
Min
Lower
Low-Mid
Mid-High
Higher
Max
Programming
Junior
Programmer
1,000
2,000
3,000
4,000
5,000
6,000
Programming
Mid-Level
Programmer
7,000
8,000
9,000
10,000
11,000
12,000
Programming
Senior
Programmer
40,000
44,500
49,000
50,000
57,500
75,000
Programming
Principal
Programmer
60,000
67,500
75,000
76,000
83,000
90,000
Programming
Director
Programmer
95,000
96,000
100,000
120,000
180,000
200,000
Design
Junior
Game Designer
24,000
25,000
26,500
27,000
28,000
29,500
Design
Mid-Level
Game Designer
30,000
32,500
34,500
35,000
37,000
41,000
Design
Senior
Game Designer
40,000
42,500
45,000
46,000
53,000
60,000
Design
Principal
Game Designer
55,000
57,500
60,000
61,000
65,000
70,000
Design
Director
Game Designer
60,000
65,000
70,000
71,000
80,500
90,000

Highlighting cells based on other cells' values is going to use Conditional formatting.
For this answer you'll need Excel 2021 or Excel for Office 365.
Select the range D2:I18, click 'Conditional Formatting' > 'New Rule' in home tab and change the setting to 'Use a formula to determine which cells to format'.
The formula you need to use will be
=AND(ABS(D2-$M$2)=MIN(ABS(DROP($D:$I, 1)-$M$2)), $A2=$L$2)
You can then use the formatting settings to select whatever format you need to 'Highlight' relevant cells, e.g. change the fill to yellow.

Related

Formula or function for getting salesperson monthly sales average

Salesperson
JANUARY
FEBRUARY
SALES TYPE 1
'=January Ave
'=February Ave
SALES TYPE 2
'=January Ave
'=February Ave
I need help figuring out what formulas/nested functions I would use in the January and February average columns in the above table. The Excel document I'm working with has a tab for each sales person. In these tabs include the above table-like scorecard element.
I'm using the old "Sharing" feature of Excel which has a lot of limitations, you can't have tables in the document for example (experts, correct me if I am wrong about this) this is why I'm hoping to use a formula to get, calculate and input the data where it needs to go.
There is another tab where all the data is stored in a table-like structure. It has columns for the date of the sale, the ID of the sales person and how many sales were made on that day.
I'm also worried that too complicated of a formula being done 24 times in each sheet and there being a total of 50 sheets in the document, would this cause the document to lag? I'm reading on index match vs xlookup, I hear sumifs is easy but the file doesn't work as fast with that?
What formulas would you use? Any advice how to make sure the document runs smoothly when users use it? Any advice here is welcome. Thanks in advance for you patience.

excel PowerPivot Auto Calculated Measures & Columns

After looking at a few similarish questions I figured I needed something more specific so asking here. I will start by explaining the situation:
The Setup
I have a Store which sells Cakes, Cookies and Wine. I have the weekly sales data of each product sorta like this:
Product ID
Product Name
Quantity
Value
Week Ending
1
Ginderbread
2
£4
13/01/22
2
Chocolate chip
5
£25
13/01/22
3
Red Wine Bottle
1
£10
13/01/22
4
Sponge Cake
3
£9
13/01/22
Currently every week's data is stored within the same table, with me using a Week filter to show only the week i'm interested in.
Using this Data I created PivotTables that shows the sales of each category, with the ability to drill down to show the specific products. Table looks something like this:
Category
Quantity
Value
Cakes
2
£4
Cookies
7
£29
Wine
1
£10
The issue
I now want to stick in a new calculated column that shows the Value as a %. E.g The total value for the previous table was £43, so Cookies is about 67%. If I drill down, it would show the Chocolate Chip record as 80% and Gingerbread as 20%
I imagine doing this would be easier if each individual week's data was on a different table, but I got a lot of weeks and I also want to do tables showing the sales for over a period of time. Plus I don't know of a way to merge the "value" and "quantity" columns, etc instead of having 1 for each week being shown.
any advice would be appreciated
Create an extra column in the source table (prior to filtering) entitled "perc" calculated as the corresponding value for each row divdied by the total value across all rows (se pic. / eqn. for first row below) --
=E2/$E$6
No calculated fields required - just include perc as the mesaure of interest in your pivot table, with value setting as 'sum':
The reason why this worked is because of the common denominator - which allows one to sum ratios on a 1:1 basis.
Devising a calculated field using the standard 'fields, items & sets' functionality for ordinary pivot tables would not be feasible / possible as far as I am aware. You would need to move into the realm of power pivots and data models - which is not too complicated (readily accesible directly from the field list per below) - however, I see this as unnecessary complication for the task at hand.
Side notes:
Using table names in your functions is sometimes more convenient when entering, albeit may appear tricky at first when reviewing - first eqn above becomes:
=[#Value]/Table1[[#Totals],[Value]]

Excel - Identifying when excluded codes are billed together

Background: I work in healthcare, and the proprietary software my company uses has not quite caught up with the new ICD-10 regulations.
I can export a list of all patients and all ICD-10 codes billed for each patient to Excel. The patient names are in one column, the billing codes are in another column.
Certain ICD-10 codes cannot be billed together for the same patient, ex.: if code A and code B are billed for Mary Smith, the claim will be denied. I've created a list in a different spreadsheet with two columns of codes which is over 20k rows long.
I need to be able to identify if any of the patients in the first spreadsheet have excluded codes billed together.
I am currently using the following formula:
=IF(COUNTIFS(COLUMN WITH PATIENT NAMES,FIRST CELL WITH PATIENT NAME,COLUMN WITH BILLING CODE,VLOOKUP(FIRST CELL WITH BILLING CODE,TABLE WITH EXCEPTIONS,2,FALSE))>0,"Code Error","")
This formula worked fine when I tested it with just a few excluded combinations, but it does not work with the full list of exceptions.
I'm thinking I might need an array formula of some sort, but I haven't really worked with those.
Any thoughts?
EDIT: Here's a picture of what I'm working with -
Excel Data Screenshot
A PivotTable (people for Rows, ICD-10 codes for Columns, Count of people for Values) is, in theory, a way to create a matrix to which say Conditional Formatting rules could be applied to identify where clashes exist. However whether viable for this OP is not clear to me and I doubt will be clarified.

Excel: Allocating Streams to Students based on GPA and Choice Preference

I have a total of 64 students to be allocated to 19 different streams on the basis of their GPA. Students have also indicated their preference for the streams. Only 5 students can be allocated to first three streams (A-C), 4 students to Stream D and the remaining fifteen streams get 3 students each. I have added the data to an excel sheet but have no idea how to process that to achieve the above results. The data is organized like this. I'm happy to share the original file but couldn't find way to upload that.
This could be solved automatically in a vba macro but the slightly faster version is doing it a bit fast and dirty with formulas. It starts like you have already, ranking by gpa.
Insert 2 rows for each student. In this row you will calculate the "filling" of the streams. If you have a bazillion students, you should write a small macro to copy paste so you get every other line. A shame that excel does not accept pasting empty values as no-change-values.
Either change the rankings by search/replace or create a new sheet where the "desired allocation" value is HIGHEST for the MOST WANTED stream.
Cell C2 should be like this:
=20-'originalsheet'!C2
We are now working on the new sheet
So you have these rows: (student - allocation - availability - student - allocation - availability)
In the allocation line, you will fill the allocation of the student above, in the availability row you will fill the current available spaces.
The first student gets allocated to his or hers choice.
The allocation row gets a formula that investigates if the current cell has the lowest possible value. So. Row2: first student, Row3: Allocation, Row4: new availability, Row5: Students wishes, Row 6: We use this formula in cell C6
=if(sumproduct(max(($C5:$U5)*(($C4:$U4)>0)))=C6;1;0)
Then the next line, new availability is simply
=C4-C6
copy paste the formulas downwards. You may get trouble with students on exactly similar GPAs but your ranking from top to bottom is what sets the priority in this scheme. I don't have the original file and I don't have time to build it from an image but it looked like it worked for my tiny test-setup.
Slightly easier than doing it by hand, but again; if you have a bazillion students and are doing this allocation often - ask in the vba section.
Summary:
Rank by GPA
Change so highest wish is highest number
Insert 2 rows for each student
Calculate manually for first student, should not be difficult...
Use formulas and make certain the cell references are not bungled up.

How Do You Subtotal with Autofilter in Excel?

I am currently working on an Excel sheet of list of people working in a company.
The company has multiple teams and multiple positions and I've listed them all in an Excel sheet (I am using Excel 2007). And because the positions and the list of people may differ on daily basis (based on who gets promoted or fired) I had to make date column and place a filter on the "date", "position", and "team".
Now I want to make it so that I filter it out for, let's say, year = 2011, position = team manager, team = information tech. team.
I have managed to get this far on my own but now I am wondering when I filter this out (out of 700+ lines), based on the position or team name, if I can add the total number of people under the same team or same positions.
For example, if there are 10 people under information tech. team, can I make it so it displays "total number of people = 10", without me having to count each one of them by hand when I apply the filter?
Also, if there are 4 people under information tech. team as the manager, it would show that "total number of managers under IT team = 4".
Are there any commands or methods I can use in Excel to do this?
Enter the following in the cell you want it in, and it will change, as per this link:
=SUBTOTAL(3, C2:C1000)

Resources