Calculate Sum of occurrences in Excel - excel

I currently have the following data set: >>> see first image for dataset and second image for expected outcome
This continues on for about 12 columns with Service_12 and has multiple rows for Company_id about 620,000 rows
I would like a way to find the interaction between services for a company
so i would like to create a table that looks something like this
Service_1 Service_2 Service_3
Service_1 (Amount of companies (Amount of companies (Amount comps
that used 1 that used that used
Service_1) service_1 and Service_2) service1 + sr3)
Service_2 (as above) (as above) (as above)
I would like this cross service to continue for all 12 services, so for example this is just the sum of the times a company has used both services,
Any ideas?
Thanks
I would like an aoutcome like the folloowing:
my dataset is the following:

Try to use this
=COUNTIFS(B2:B5,">0",C2:C5,">0")
this formula should give you how many companies used service 1 (column B) and service 2(column C) or
=SUMIFS(B2:B5,B2:B5,">0",C2:C5,">0")+SUMIFS(C2:C5,B2:B5,">0",C2:C5,">0")
if you want to know how many times the station were actually used.

I think a Pivot table would do this.
I would use a dynamic named range to capture your data if you intend to add companies more often:
https://support.microsoft.com/en-us/help/830287/how-to-create-a-dynamic-defined-range-in-an-excel-worksheet
If you put "Services" in the rows and columns, and Count(companies) in the values box that should do it!

Related

Cognos: Using rank() across multiple columns to order bar chart

I have some example data like this table:
where the left table is currently the data I have and I want to order by year, company, and product (based on total cost). Currently, the user chooses the year and company on the prompt screen and I am trying to obtain something like a top ten list per year per company based on the total cost per product. I would like my data to sort to the table on the right with keeping track of the billing code area, but not sorting by it. I have been able to write a SQL code that will sort it using a group by, but I cannot add the billing code area. I need the billing code area to display the information in a bar chart.
I have tried using the rank function in Cognos, but I can only do it for one column. I have also tried concatenating the 3 columns together, but no luck with that either. Is there any way to use rank() for 3 columns?
Looks like you have two different tasks:
Calculate top 5
AFAIR you can use rank() like this:
rank([total_cost] for [Country],[Year],[Product])
List all billing area codes. It's not so simple. There is no special function for it (shame on them). So you can write custom query for it using features of you DB or, better, fake concatenation with repeater object or crosstab with master-detail relationship inserted in Billing Area Code field.

Excel dependent list best way to sort 2000 records?

I have a data set of 4 columns and around 2000 rows. I need to produce an easy to use dashboard type product so anyone in can filter down to find the relevant record. Think of it as filtering down eg country - region - city - contact person
I have mocked something up using dependent drop down lists using a much smaller data set but it seems hard to scale this up, is there a better way in Excel of doing this?
PivotTable example, where Data is shown in ColumnsA:E of the same sheet, but could be on a different sheet):
each of id, c, r, c, and p is in ROWS (in order). Each small + and - can be expanded/collapsed independently (in the example all are collapsed except D and elements within D).

Have VBA for Unique items in multicolumn range, how to filter multiple rows on previous results?

Intro
I'm trying to enhance a basic planning sheet (see below) with additional sorting.
The first column lists the resources. Each week has 2 columns representing 20 hours per column.
Example readout;
In week 30 Aron works 40h on project A. In week 31 he works 20h on project A and 20h on project B.
Jeff does not work in WK30 and works 40 on project C in WK31
My Goal
Generate a unique list of projects over the weeks
Be able to filter based on project name and get only the rows of the resources working on that project. (No specific need to filter out the other projects in the same row. So if I filter on project "A", I want to only see the rows of Aron and Dave)
What I have
Basically item 1 is covered as follows:
The 2nd column (Projects) is an array-formula generated by a VBA function (taken from here) that returns all unique items in a multi column range. The cell formula looks like this, where the second argument of UniqueItems() determines if we only return the number of unique items (TRUE) or a list of all unique values (FALSE).
=TRANSPOSE(UniqueItems($C$4:$H$6,FALSE))
What is missing
Item 2 of my goal list is missing. If I currently select the filter option for Projects (see screenshot)
and filter on Project A, then I only get row 5 and not also row 4.
How would I go about filtering this properly?
VBA code is allowed or pointers to which regular formula functions I should use. A complete different solution with the same results is also fine. I thought about pivot tables, but I think it cannot handle empty cells around the range which is common if there's no work for that resource.
The sheet used can be downloaded from here
IMHO, you will be much better off creating a worksheet serving as a normalized database table with one row per the following columns: person, week, project. Lastly, a final column for the number of hours (and optionally, a cost for those hours customized per worker as needed)
Then use a pivot table to build the view you posted (or any other reporting view you need).
This will let you create multiple pivot tables that easily answer questions like:
how many hours are planned for project X in total? by a certain date?
how many total hours are planned for each worker per time period - who is over/under utilized?
how many total hours are planned for each worker per project?
etc.
Keeping the data separate from the reports is safer, and more modular - I wouldn't want a VBA bug to have the potential of corrupting/deleting raw data.

Excel Management for Inventory

Okay, hope this question will be clear enough that I can get an answer. Thanks for the help.
The situation is that I am downloading some information into two different spreadsheets which contains orders from two different stores.
The problem is that between these two stores the model numbers (SKU#) for a lot of items are different even though the product is the same. There is no changing that now. I do have a list of equivalencies. For example, I know that 00-XX-55 is the same in Store 1 as 22-FF-33. There isn't a logical equivalency so I would be setting them manually.
My question is if there is any way I can combine data from two sheets and set up manual equivalencies while doing this? Would excel allow me to manage the data in that way I can join the two unequal SKUs
You need a two-column translation table. Once you have this you can manage combined inventory because you can then determine the total inventory of a single item in both stores.
So in a solution do you want to translate all to the store 1 sku, the store 2 sku, or a third warehouse sku? I guess what I am driving at here is that there needs to be a superior synonym to sort of design around.
To build a translation table you would put the original sku (the sku that you will convert from, sort of the inferior number you do not want to go by for purposes of the summarization) into column A and the master sku into column B. We will call this sheet "converter".
You could either have:
A, B
00-XX-55, 22-FF-33
This could normalize everything to the 22- sku. Or you could do this:
A, B
00-XX-55, 123abc
22-FF-33, 123abc
This way if you want to normalize to a third value rather than either of the stores values.
In your inventory page col C is the sku column so in column D put =iferror(vlookup(C, converter!A:B, 2, false), C) and populate that all the way down. Now in each row you have the original and the master sku next to each other in C and D. If the sku was not found in the converter table then it would just use whatever value was in C. You can then build pivots tables using D to group them on.

Looking up values from different tables including newly found values

I have several documents which contain statistical data of performance of companies. There are about 60 different excel sheets representing different months and I want to collect data into one big table. Original tables looks something like this, but are bigger:
Each company takes two rows which represent their profit from the sales of the product and cost to manufacture the product.I need both of these numbers.
As I said, there are ~60 these tables and I want to extract information about Product2. I want to put everything into one table where columns would represent months and rows - profit and costs of each company. It could be easily done (I think) with INDEX function as all sheets are named similarly. The problem I faced is that at some periods of time other companies enter the market:
Some of them stay, some of them fail. I would like to collect information on all companies that exist today or ever existed, but newly found companies distort the list (in second picture we see, that company BA is in 4th row, not BB). As row of a company changes from time to time, using INDEX becomes problematic, because in some cases results of different companies get into one row. Adjusting them one by one seems very painful.
Maybe there is some quick and efficient method to solve such problem?
Any help or ideas would be appreciated.
One think you may want to try is linking the Excel spreadsheets as tables in Access. From there you can create a query that ties the tables together. As data changes in the spreadsheets, the query will reflect those changes.

Resources