Excel: finding matching names between columns when names are part of longer string in one column - excel

I have one column/list filled with appointment information (column A), and another separate column/list of clinician names ( column C). I am interested in simplifying column A down to just a clinician name(its match from column C). Is there a method/approach which could be used to find matches in column A and C, and then list them in column B?
Column A has about 1,100 rows, Column C about 200 rows(names).
Thank you in advance for your time and consideration!
Column A
Appointment Info
08/06/2018 # 10:00 AM
(240 min)
AA MH/PHD Testing CLC=IP
Est Patient
CID/PID:08/06/2018
(Wait: 0 days)
Scheduled on: 6/13/2018
By: Suzie Chapstick
Comments: F107
No Show Count:4
Miles to Clinic: NA
08/08/2018 # 12:00 PM
(120 min)
AA MHC/CHOL-Harpman EVAL
New Patient
CID/PID:07/03/2018
(Wait:36 Days)
Scheduled on: 7/3/2018
By: Legg, Stanley
Comments: Per MHC
NoShow Count: 7
Miles to Clinic: NA
08/06/2018 # 09:00 AM
(180 min)
AA MHC/PSY-Stinger Intake
New Patient
CID/PID: 6/7/2018
(Wait:60 days)
Scheduled on: 7/6/2018
By: Finkbeiner, Maria
Comments: Per MHC
NoShowCount: 3
Miles to Clinic: 16
Column C
Brown
Duncan
Finley
Harpman
Stinger

You can try this:
=IFERROR(INDEX(Clinicians,MATCH(1,MATCH("*"&Clinicians&"*",A1:A10,0),0)),"not found")
Here are my results:
I gave the Clinicians a range to help the readablity, the same could be done with Col A. I'd also suggest the clinicians be on a separate tab altogether.
The First "not found" has no "hits" in the clinicians list, the second and third are opposite blank cells.
Hope that helps
Good Luck

Related

Average based on day of the week

I would like to have an overview of averages achieved in column H for each day of the week. The daily Averages should go into smaller table as per below. Thanks in advance.
You can do this, combining AverageIf() and Weekday() function, as in the following example I've created:
A B C
========== = =================
11/10/2021 6 =WEEKDAY(A1,2)=1
12/10/2021 8 =WEEKDAY(A2,2)=1
13/10/2021 5 =WEEKDAY(A3,2)=1
14/10/2021 8 =WEEKDAY(A4,2)=1
15/10/2021 6 =WEEKDAY(A5,2)=1
16/10/2021 4 =WEEKDAY(A6,2)=1
17/10/2021 2 =WEEKDAY(A7,2)=1
18/10/2021 2 =WEEKDAY(A8,2)=1
19/10/2021 6 =WEEKDAY(A9,2)=1
20/10/2021 8 =WEEKDAY(A10,2)=1
Afterwards, I've created the formula:
=AVERAGEIF(C1:C10,"TRUE",B1:B10)
This formula calculates the average of the values in column B for all Mondays in column A.
How does this work?
The Weekday() function calculates the number of the day of the week, based on a switch: when the switch is "2", it sees Monday as 1, Tuesday as 2, ...
The AverageIf() function then:
Checks the column C for the values to be checked
Checks those values against "TRUE"
Calculates the average of the B column for the values, obeying the aforementioned criteria.

Excel formula that returns sum based on categorical and date data from 2 columns?

I have a dataset in excel that looks like this:
Supplier Date QTY
A 03/02/2018 10
A 05/01/2018 15
A 08/06/2018 30
B 02/01/2018 20
B 04/01/2018 50
B 08/01/2018 40
B 08/15/2018 50
B 10/01/2018 60
C 03/09/2018 25
C 04/08/2018 25
C 05/20/2018 25
And I want to make a spreadsheet that allows the user to enter start and end dates and the Supplier name and be able to see a total quantity of items received in that time period from that supplier.
I've tried using a combination of VLOOKUP and SUM, but I've only been able to get the first result of the quantity associated with that supplier to return. I understand that this is the nature of VLOOKUP--to only return one value. I'm pretty new to Excel so I just don't really even know which function(s) would be best to use in this scenario.
Example Output:
Enter Supplier: "B"
Enter Start Date: "03/01/2018"
Enter End Date: "09/01/2018"
Items Received: 140
Try:
=SUMPRODUCT((A2:A12=F1)*(B2:B12>=F2)*(B2:B12<=F3)*(C2:C12))
Result:

IF value in list, perform VLOOKUP and add result

I have a list of employees, a column stating their 'available days multiplier' (eg a full time employee would be 1.0, a part time employee working 4 days out of 5 would be 0.91, 3 days would be 0.80 and so on. The next column calculates the employees available holidays, based on a standard 30 days multiplied by the 'available days multiplier'. See below, with an example formula in brackets :
A B C
1 Name | Available Days Multiplier | Holidays
2 Employee A | 1 | 30 (=30*B2)
3 Employee B | 0.91 | 27
4 Employee C | 0.91 | 27
5 Employee D | 1 | 30
Employees have an option to purchase additional holidays, which I have stored in a separate table containing 'Name' and 'Days'
S T
1 Name | Purchased Days
2 Employee 2 | 5
3 Employee 4 | 3
I would like to amend the formula in column C to not only calculate the holidays based on available days multiplier, but also to look up the list in columns S:T and add on any purchased days, if the employee name is found.
I suspect this could be quite easy with an IF/VLOOKUP combination, but I cannot find the correct syntax. Any help greatly appreciated.
If I have understood correctly, you could use SUMIFS:
=(30*$B2)+SUMIFS($T$2:$T$3,$S$2:$S$3,$A2)
This works by first calculating the number of holidays as you have been doing and then adding any purchased ones.
If the employees name appears more than once in the list, it will add the total sum of purchased holidays to the total.
SUMIFS sums the first range (T2:T3) if the second range (S2:S3) matches the criteria (A2).
Hope this helps. If you need further clarification, please let me know.

How to calculate workdays and compensation for given period based on Employee's monthly salary?

I have only three editable fields:
salary = 15,000
start date = 18 Jul 2014
end date = 12 Oct 2014
With these fields, I need to calculate the total salary I need to pay. Payment is on a monthly basis:
(JULY = 15,000 / 31 * 14) +
(AUG = 15,000 / 31 * 31) +
(SEPT = 15,000 / 30 * 30) +
(OCT = 15,000 / 30 * 12).
I can get total days based on both dates (ie 87 days, =DAYS($enddate,$startdate)+1) ) but I need to split the days according to the months.
What formula do I need automatically to get the amount, because each person will have different salary and different dates?
You can use Excel VBA custom Function to solve your problem:
1). First, you should populate Excel Worksheet with data structure reflecting Employees Name, Monthly Salary, StartDate and EndDate, like in the following sample:
Employee M.Salary Start Date EndDate
John $15,000.00 7/18/2014 10/12/2014
Ann $20,000.00 7/19/2014 10/13/2014
Peter $16,000.00 7/20/2014 10/14/2014
Jeff $25,000.00 7/21/2014 10/15/2014
2). The DAYS in date range can be simply found by subtraction (EndDate-StartDate), because the underlying data type in integer
3). For general solution to the problem (Calculate the compensation for any arbitrary period and monthly salary) you will need to create custom VBA formula and use it in a separate column for each Employee. Refer to this article for explanation: Create a custom worksheet function in Excel VBA
4). Pertinent to your particular case with fixed date rage, the simplified solution based on the Excel Worksheet formulas (no VBA) is described below:
Employee MoSalary Start End Days FullMo FirstMo LastMo Total
John $15,000.00 7/18/2014 10/12/2014 87 30000.00 $6,774.19 $6,000.00 $42,774.19
Ann $20,000.00 7/18/2014 10/12/2014 87 40000.00 $9,032.26 $8,000.00 $57,032.26
Peter $16,000.00 7/18/2014 10/12/2014 87 32000.00 $7,225.81 $6,400.00 $45,625.81
Jeff $25,000.00 7/18/2014 10/12/2014 87 50000.00 $11,290.32 $10,000.00 $71,290.32
4a). In column E starting with row 2 add formula for DAYS : =(D2-C2)+1 and extend it for entire range
4b). In column F starting with row 2 add formula for whole months : =2*B2 and extend it for entire range
4c). In column G starting with row 2 add formula for the first month : =14*B2/31 and extend it for entire range
4d). In column H starting with row 2 add formula for last month : =12*B2/30 and extend it for entire range
4e). In column I starting with row 2 add formula for total compensation : =SUM(F2:H2) and extend it for entire range
Hope this will help. Best regards,
I have split this out because I am not entirely sure what you require and you may be able to assemble the pieces in a way that better suits you:
Assuming your data is in A1:A3, put 1/7/14 in C1, 1/8/14 in D1, 1/9/14 in E1 and 1/10/14 in F1.
To count the number of applicable days by month, in C2 enter:
=IF(MONTH($A2)=MONTH(C1),EOMONTH(C1,0)-$A2+1,IF(MONTH($A3)=MONTH(C1),DAY($A3),EOMONTH(C1,0)-EOMONTH(C1,-1)))
To compute the salary for the month by computing the daily rate for the applicable month and multiplying that by the number of days from above, in C3 enter:
=$A1*C2/(DAYS(EOMONTH(C1,0),C1)+1)
Format C2:C3 to suit and copy across to F2:F3.

Count names one time (per year) regardless of how many there are by year

The problem is:
There is a table that gets data added to it each month. I use this data for many different pivot tables and reports, so I am not able to modify it. The user has requested that if its possible (and I assured him that it was) he would like to see two (2) single values of This Year and Last Year Doctors on the list.
The data looks something like this:
Doctor, In/Out, Date, Number
John Deaux Out 10/1/11 8
John Deaux Out 11/1/11 3
John Deaux Out 01/1/12 5
John Deaux Out 05/1/12 3
John Deaux Out 09/1/12 1
Billy White In 02/1/12 2
Mike Adams Out 06/1/11 6
Mike Adams Out 10/1/11 9
Mike Adams Out 01/1/12 1
Mike Adams Out 04/1/12 6
I would have 1 John Deaux for 2011, and 1 for 2012. The same for Mike Adams.
TY 2
LY 2
Now I only have to count the "Out"(s), so I have to be careful of that. Also, there is the chance that I would have to build this for the previous 12 months as well making it that much harder.
1 for John Deaux for the previous 12 months.
TY 2
LY 1
*TY: This Year - LY: Last Year
To do this manually:
Since you can't make any edits to the existing table, copy everything to a new table.
In the new table, add a column called Year. Use the Year() function to get the year out of the date cell.
Make another column called Count. Use If(A2="Out",1,0) where A2 is the cell in the In/Out column.
Copy the Doctor, Year, and Count columns to a new table.
Excel 2007 and above has a convenient tool called Remove Duplicates in the Data ribbon. Use that to remove the duplicates. This will keep you from counting a single doctor twice in the same year.
Create a pivot table, using Doctor as the row, Year as the column, and sum(count) for the value.
Check this, this will check the B column for the year 2012/2013 and count the distinct unique values in column A.
=SUM(IF(FREQUENCY(IF(YEAR(B1:B11)=2013;A1:A11);A1:A11)>0;1)) + CONTROL + SHIFT + ENTER
=SUM(IF(FREQUENCY(IF(YEAR(B1:B11)=2012;A1:A11);A1:A11)>0;1)) + CONTROL + SHIFT + ENTER

Resources