Excel - Identifying when excluded codes are billed together - excel

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.

Related

turning rows to columns in Excel

I have an excel datasheet with more than 1,000,000 rows and 80 columns. the datasheet contains sales information of a chain store with more than 1700 store nationwide. each store is repeated 52(weeks in a year)* about 30 (products sold in that given week)* 2(two years). I want to convert the rows corresponding to products to columns. I can't do that using transverse because the products sold each week might not be exactly the same as those sold next week. do you have any solutions?
thanks
I just made a very simplified version of that excel file. the problem is that the products sold are not the same each week. there is a limited set of product, but only some of the items are sold each week
https://drive.google.com/open?id=1B2vjIL2hemfQNrCz0X6u_pzi7Euy6IWa3Lj0_HzDXDE
This isn't much of an answer yet - but it either will become one or I'll delete it, depending on the OP's response.
I'm thinking that transverse/transpose is the wrong term for what you're trying to do.
Perhaps you're just trying to better organize/visualize this data, something similar to one of these Pivot Tables:
or
These are just two of the infinite ways you can organize data in a Pivot Table.
Is that similar to what you're trying to do? If so I'll share some more info.
If this quantity of data is going to keep coming your way, way you really need is to start using an Access database to get this under control and be able to report on it properly (and easily, once it's setup).

In Excel, creating new rows based on presence of data in columns

I am very new to most of this. I am trying to analyze account attribution a large Excel spreadsheet containing invoice information. My columns A:AF are all the data describing each invoice in our system (name of provider, name of person billed, date received, date billed, etc...). These invoices are assigned to several different GL numbers (up to 22 per invoice). I was given a long string which I was able to break down into columns 4 columns per GL attribution and which I appended to the end of every invoice, where applicable (AG:EL).
Each GL attribution has 4 columns (always in the same order):
GL number
Billed amount before taxes
Amount of tax 1
Amount of tax 2
I would like to see whether there is any way I can have rows created automatically to have one entry per GL attribution instead of one entry per invoice. I would like for the general invoice information (A:AF) to be copied onto the newly created rows. I would really appreciate your help on this as I feel rather lost!
Thank you in advance! :)
I'm not entirely sure what you are trying to accomplish from your description, but if you look into using VBA and make an "if...Then..." statement that will copy and paste the information you want depending on the value of the GL columns that should be a good place for you to start.

Index Match Match across multiple columns

I have an Index Match Match question that I have not been able to find the answer for in researching. Although the solution may actually might be different than an Index Match Match formula - I'm open to try something more efficient than my current workaround.
I have one worksheet with data from my company on it. We sell a Product (let's call it Coke Zero) and we track the weeks that we put a promotion on and how much profit we make by selling it to the retailer. For example a promotion for Coke Zero starts the first week of Jan and ends 3 weeks later and we make a gross profit of $100 each week the promotion runs. I then have an external database with sales data formatted on a weekly basis to tell me how many units of Coke Zero I sold in each week. My internal data has thousands of lines like this with dozens of products, however the promotions are consolidated on one single row regardless of if it runs for more than one week, making matching up to the external database difficult. I need to create a lookup for what our Gross Profit was for each week of the promotion.
I have attached an example image of the workbook + two data sheets of what I've tried to do, summarised below.
On the Internal Data Sheet I've created additional columns to the right with all of the weeks listed that the promotion is on for, and concatenated them with the Product Code to be able to match week by week to the data in the External data sheet. Then my lookup basically checks every column one after another until it finds one where the concatenate of Week_Product Code concatenate matches.
My current solution technically works but my final formula is really slow and cumbersome given the data can be anywhere from 10K-200K lines when looking at multiple retailers. I was hoping to find a more efficient formula to complete the lookup.
Current solution on the External Data Sheet Column E:
=IF(ISNUMBER(MATCH(D2,'Internal Data'!$E:$E,0)),INDEX('Internal Data'!$D:$D,MATCH(D2,'Internal Data'!$E:$E,0)),
IF(ISNUMBER(MATCH(D2,'Internal Data'!$F:$F,0)),INDEX('Internal Data'!$D:$D,MATCH(D2,'Internal Data'!$F:$F,0)),
IF(ISNUMBER(MATCH(D2,'Internal Data'!$G:$G,0)),INDEX('Internal Data'!$D:$D,MATCH(D2,'Internal Data'!$G:$G,0)),
"0")))
I got SUMPRODUCT to work using this formula in J2:
=SUMPRODUCT(--($B$2:$D$3=H2)*--($E$2:$E$3=I2)*$F$2:$F$3)
And, you don't need those concatenated lookup columns:
Well, that was fun.

How Do I Nest IF Functions in Order to Calculate Daily Revenue?

I am working on a data set and I need to calculate the daily revenue of fake AirBnb listings using nested IF statements. This is for a bootcamp I am attending, and I am stuck.
My instructions are as follows:
Estimate revenue per listing
Assume each booking always has 2 guests, unless the listing accommodates only one;
The booking is always for the minimum number of days allowed;
Only half of the bookings generate a review;
The extra person charge is per night (column name ‘extra_people’)
○ Format: have a column that calculates daily revenue (account for number of guests accommodated, number of guests included in the price, extra charge for additional people - using nested IF statements); another column would then calculates revenue per booking; finally, multiply that by the number of total stays the listings has had.
Using the data in my dataset, I am attempting to fill out column AA. So far this is what I have for my formula,
However, I get an error. I know the first part of this formula would work for the scenario in row 4. However, I need to make sure that the formula takes into account scenarios where the "guests included" is less than the "accommodates", because I must assume that each booking always has two guests except for when the listing only accommodates one person.
How should this formula be written? Can I not create equations within nested if formulas if it includes adding, subtracting, dividing, or multiplying columns together?
To clarify the previous response a bit more, the structuring of IFstatements is important. Keep in mind the structure of the function: =IF(logical test, value if true, value if false). So, the second IF function (the first nested) needs to be placed where the first "value if false" comes in - each additional IF needs to be within the previous IF function. Using your example, the corrected form would be =IF(W4=Q4,V4,IF(W4<Q4,Q4*V4...)). I'm not sure what the "+X4" is supposed to be adding to, but this hopefully makes the structure clearer for you to work with. Good luck!

Excel pivot table question - How to get subtotals for a row area field?

I have the following situation in database:
Department table holds all departments in the company.
Employee table holds all employees, together with their department id and AllowedAbsenceDays field, which tells us how many days is the employee alowed to be absent in the current year.
Absence table holds all absences that occur in the company. It has employee id and date of absence, and also the reason of the absence (vacation, sick leave, personal days, and potentially more in the future...)
I am supposed to create a report which lists all employees and shows how many days they are allowed to be absent together with how many days have they been absent (and what is the reason of absence).
I have grouped the data by employee and by reason of absence:
This is what I am able to get so far, by putting the Department, Employee and Allowed Absence Days in the pivot row area, Reason in the column area and Sum of Days absent in the data area:
The problem is that I am not able to get the subtotals of allowed absence days per department (which is a firm requirement). The final report should look somewhat like this (i have photoshopped this).
Is there any way to get these subtotals? Maybe I should prepare the data for the pivot table in a different way? Please note that the Grand Total column should include only the actual days of absence (not the Allowed Absence Days).
Example workbook is available for download here
Thanks to everybody who is still reading :)
P.S. The real case is different (in the problem domain). This is a somewhat contrived example, but the basic problem is the same.
It's a classic data normalisation issue. The "Allowed absence days" field relates to the employee and not to any particular absence. The repetition of this info in every row (record) is what is causing the problem.
To achieve this within an Excel sheet and pivot table, you could remove the "Allowed absence days" column and instead use "Allowed absence days" as one of the values in the "Reason" column. It might be beneficial to either show allowed days as a negative amount or to show days for the other absence reasons as negatives. Otherwise the overall grand total will make no real sense.
Sheet and pivot table should look roughly like this:
Excel spreadsheet showing restructured data: column A is department, B is employee, C is days absent, D is reason. Allowed absence days is now a reason and associated days absent is negative http://img527.imageshack.us/img527/1979/so1.png
Repeating the department for every employee doesn't seem ideal but I suppose an employee could change department during the year so you might/might not have to account for that somehow. You also need it to make the pivot table work anyway
If you absolutely 100% cannot have the grand total affected in this way then I don't believe that you can achieve this with a pivot table. You might want to look at using ADO to query the sheet and use some VBA macros to format and output the results. This page should give you some idea of what's involved
Just leave "allowed absence days" blank in all rows, and then at the bottom/top put in rows with the wished for numbers for "allowed absence days" and blanks for the other stuff.
Then just put your "allowed absence days" in data instead of columns in the pivot and drag it to the left.

Resources