Criteria of SUMIF Function referring to data previously in table - excel

Is there a way to add values in Excel based off of values previously in table?
For example, in the table I currently have, is there a way to exclude adding the 1 from the "Attended" column in the "Sonics and Cold Cash" row because I already had a row with "Sonics" and "1" in attended? I don't want to add a 1 to the SUMIF function if I have already attended that team once before.
I hope this is clear enough for some help. Thank you!
edit: So far, I have a table that tracks how many times a team has been "attended". This works, however I am trying to use linear optimization for scheduling, and using the results table has some linearity problems. I'm trying to find a way to only use the table instead of a second, results table.

Related

Comparing two tables of different size, with multiple columns in VBA

Looking to use VBA to compare two tables, with three columns each against each other. Beginner here and very lost.
They may have a different amount of entries each, and there may be some in table A that aren't in table B, and vice versa
Some of the individual Columns may match but trying to work out how to make sure all three columns are compared as one against all three columns in the other table
For example
xyz123 55.50 12/07/21 if compared with XYZ123 54.55 12/07/21 will show up as not a match, because the middle column is a different number.
Have attached a picture below. For the most part, and unlike the photo, each table will be in a completely random order, and its unlikely that there will be the same entry in table 1, row 1, as table 2 row 1
Ideally, I'm trying to create two new table to the right of the original tables, the first one being the entries table 1 has, that table 2 does not have. The second one being the entries table 2 has, that table 1 does not have.
Have attached an example below of the end result I'm looking for out of this. The four rows on the left are entries that the first table has but the second table doesn't, and the rows to the right are all entries that the second table has, but the first table does not.
I've tried to search on this but haven't found something that matches what I've got, and I'm struggling to adapt someone else's code to my specific problem
Any help on this would be greatly appreciated
Maybe not a direct answer to your problem but is this data also in a database somewhere or are you familiar with Ms Access? As you could open the tables in Access, and it is pretty easy to do this kind of thing with data bases.
If not, then yes, it is do able with VBA. Numerous ways of doing it.
The simplest is to scroll through one table a line at a time and compare it with every row in the other table and match or not. This will work with small tables and be easy and quick but for large data tables it would be wasteful and may take a long time to complete.

Excel sheets with scores by same ID of person (Kahoot) - How to extract and summarize scores from several quizzes?

I've used Kahoot in the classroom and have several excel files with scores from quizzes.
Students attended quizzes by using unique IDs. In each file, scores are visible for each ID (but ordered by success on each quiz). There are also some students missing or stating wrong IDs (I'll ignore it).
Now I would like to accumulate all scores for all student IDs in one sheet and summarize them by Student ID.
How can I do that most efficiently?
Any pointer or advice is appreciated.
Thanks,
B.
Here's a high level guide to getting what you want along with a sample in this file.
Step 1 - Combine Files to Sheet with Unified Columns
Objective
The goal here is to:
Combine all of your data from other files to single sheet
Merge the data to be in a single column for each field (i.e. Column A has ID, Column B has score).
No breaks in rows.
No formulas.
To illustrate, I made this fake list based loosely on your
description.
Method
You probably can do this manually, but a macro could also be used. If you expect to do this year over year, you might look into vba to open close files in a folder. However, since that wasn't part of question, you can do copy-paste (better yet make a kid do it!). Just make sure there's only one header for each column, and all of the data records align. Probably should do copy paste value if you have any formulas.
Step 2 - Show Summation
There's a couple ways this could be done. A pivot table is probably the most sensible because you could include each quiz as a column to see the total. You could also use a pivot table to do averages by student etc.
TO make a pivot table, I would recommend going on YouTube and they will do a better job of explaining than me.
On that same file I made as an example, I included some tabs to illustrate the power of pivot tables and a couple graphs.
Hope that helps. If you have specific technical questions on this, you might consider asking separately.

Avoid DISTINCTCOUNT in PowerPivot

Due to performance issues I need to remove a few distinct counts on my DAX. However, I have a particular scenario and I can't figure out how to do it.
As example, let's say one or more restaurants can be hired at one or more feasts and prepare one or more menus (see data below).
I want a PowerPivot table that shows in how many feasts each restaurant was present (see table below). I achieved this by using distinctcount.
Why not precalculating this on Power Query? The real data I have is a bit more complex (more ID columns) and in order to be able to pivot the data I would have to calculate thousands of possible combinations.
I tried adding to my model a Feast dimensional table (on the example this would only be 1 column of 2 rows). I was hoping to use that relationship to be able to make a straight count, but I haven't been able to come up with the right DAX to do so.
You could use COUNTROWS() combined with VALUES().
Specifically, COUNTROWS() will give you the count of rows in a table. That means COUNTROWS is expecting a table is input. Here's the magic part: VALUES() will return a table as results, and the table it returns are the distinct values in the table/column that you provide as the argument for VALUES().
I'm not sure if I'm explaining it well, so for the sample data you provided, the measure would look like this (assuming the table is named Table1):
Unique Feasts:=COUNTROWS(VALUES('Table1'[Feast Id]))
You can then create a pivot table from Powerpivot, and drag Restaurant Id into Rows, and drag the measure above into Values. Same result as DISTINCTCOUNT, but with less performance overhead (I think).

Excel: Averaging the values from a set of rows, but only include them if they have a specific value in a column

I'm looking for help dynamically averaging the column values of every item in an Excel table that has a given value in one of its columns. Specifically:
I have an Excel sheet where each row represents an entity in a video game I am working on, and each column is a numerical value for different attributes on these entities. Movement Speed, Health, Attack Damage, etc. Each of these rows also has a column where I tag the row with the name of the class that this entity is a part of: "tank", "support", etc. This table has roughly a hundred items in it, and is likely to grow to two or three times that size.
It looks something like this:
What I would really like to do is have, on a separate tab, a table where each row represents one of the classes, and shows the average value of all of the entities that have that class in their "group" column. And I want it to automatically include new entities of that class as they are added to the first table.
It would look something like this, where these values are automatically generated from the data in the first table (I have no problem manually entering the class names, I just need the numerical data to be driven):
I imagine that the solution will be a complex, nested pile of VLOOKUPs and MATCHes and other Excel functions, but I am not really sure how to accomplish this. I didn't even know the proper terminology to search for existing answers to this question, so I hope that it isn't too redundant. Thanks very much for any advice you have!
Version: I am using Excel 2013.
I think all you need is a pivot table. (its been around since the 90s?) - and very useful!
there are lots of ways of refreshing etc depending on where the data comes from
http://office.microsoft.com/en-us/excel-help/pivottable-reports-101-HA001034632.aspx

Dax code: find sum of values filtered by month

I have seen some posts that address this concept online, but I have been unable to adapt them to my needs.
Scenario:
I have a table with three columns.
Column A- [Month] (formatted mm/dd/yyyy)
Column B- [salesperson]
Column C- [Assets]
I am trying to determine a formula which will return the total assets for all salespeople for each month in a fourth column.
Why am I doing this? I am building a report which will generate a graph from this data. In reality there will be additional columns which will contain values for some variables. I will be using the slicer function in conjunction with these variables to create an interactive functionality within the graph. Hard coded references won't work for me, as this will be a recurring report, and the dataset will be refreshed with current data regularly.
Thank you for any help you can offer. I'm still fairly new to all this (<1yr) so interpreting general formulas I've found elsewhere has been very problematic.
Cheers!
Create a calculation like this (syntax dependent on data model)
AllSalespersons:=CALCULATE(SUM[Assets], ALL[Salesperson])
Using the CALCULATE function here is important because it will remove the row syntax for Salesperson (created in the pivottable) and give you the sum of 'ALL' salespersons for each month.
Again, you'll have to play with the syntax to fit your data model, but based on your quetsion, I think this should give you what you are looking for.

Resources