Max Value of a column in the same year and month - excel

I have to columns I want to analyse, visits and dates. I now want the max visits of a month. The data ranges over multiple years.
+--------+--------+---+
|Date |Visits |Max|
|31.12.19|77 |77 |
|01.01.20|47 | |
|02.01.20|121 | |
|03.01.20|133 |133|
...
|01.02.20|21 | |
|02.02.20|135 |135|
+--------+--------+---+

You can create easily a Pivot Table:
More about Pivot
Tables
To create this Pivot Table I did:
Date field into Rows Section and grouped by Years and Months
Visits field into Values section and selected option MAX
Group Pivot Tables
Items

Related

Dual criteria data validation in Excel

Unlike the other questions posted with this topic, my criteria are not simple comparators. I want a dropdown list that includes all values in one named table excluding those values that meet another criteria. For instance a table includes employee names in one column and vacation dates in another column. I want the data validation to allow a list of employees who are not on vacation for a variable date drawn from another cell. The general method seems to be to create additional tables where the secondary criteria (in this case date) is the column header populated by items from the first list that satisfy some criteria. It seems impractical to create 365 tables named for each date and populated by rows of employees from the first table that have not requested that date off. Is there another way to accomplish this?
Sample Data:
| Employee| Vacation Dates | | work on 1/26/20 |
_____________________________ ___________________
| Bob | 1/26/20, 1/27/20| | <allow only |
| Mike | 2/20/20, 2/21/20| | Mike or Cindy> |
| Cindy | 2/20/20, 1/28/20|
Had to transpose my thinking. Rather than a table for each date, I can have a vacation table for each employee. The validation formula has to be a custom validation rather than a list, so no drop down selection list is available, but it will work. Error message also cannot discriminate which criteria is being violated -- name not on employee list versus name from employee list who is on vacation. Would be great if validation worked like conditional formatting with different rules applied in sequence.
| Employee| Bob | Mike | Cindy | | 1/26/20 |
____________________________________| ___________
| Bob |1/26/20| 2/20/20 |2/20/20| | |
| Mike |1/27/20| 2/21/20 |1/28/20| | |
| Cindy |
The validation formula for the "1/26/20" column (F in the scheme above) would be
=AND(COUNTIF($A$2:$A$4,F2)>0,COUNTIF(INDIRECT(ADDRESS(2,MATCH(F2,$B$1:$D$1,0)+1)):INDIRECT(ADDRESS(3,MATCH(G2,$B$1:$D$1,0)+1)),F1)<1)

Count of number of unique customers by month

I have a spreadsheet that contains data for customers that have purchased items from my store. What I would like to do is go back the last couple years, using a pivot table, and display: number of customers that ordered something each month (a count of unique customer names).
The sheet is organized as such:
Date | Invoice | Account Name | Item | Quantity | Amount
6/1/2020 | 50100 | John's Tire Shop | 1/2 Inch Socket | 2 | 12.00
Is there a way inside pivot table options to count unique account names and display the total grouped by month?
You can create a helper column to identify unique values per month to add as a filter to your pivot using your existing setup
=IF(COUNTIFS($A$2:A2,A2,$B$2:B2,B2)=1,"y","n")
I would propose you to add a helper column to your data, containing the =Month(A:A) function. But be careful: I see that your first date equals "6/1/2020", is that the first of June or is this Epiphany? :-)

How do I negate a value in an Excel calculated field for a pivot table?

I've got a pivot table that has a sum of numbers aggregated per month per category. My data table looks like this:
Date | Description | Amount | Transaction Type | Category | Account Name
---------------------------------------------------------------------------------
12/16/2017 | Dinner | 150.00 | debit | Restaurants | CC
12/16/2017 | Return | 80.00 | credit | Restaurants | Cash
For the calculated field's formula, I've tried =IF('Transaction Type'="credit", -1*Amount, Amount) but it's just giving me the same sum of Amount. For this sum, I'd expect it to be 70.00 (150 - 80). Not sure what to do here.
You are after adding a calculated item rather than a calculated field as you are relying on the value of the field "Transaction Type" to determine the calculation result. See reference here
I assumed (oops) you meant credit - debit but, if not, simply swop the items around in the formula.
With your initial pivottable set up
With either Debit or Credit in the column headers of the pivot selected goto
Fields, Items, & Sets in the Analyze tab and selected Calculated Item
then add the following:
Name: Net
Formula: =' credit '-' debit '
Example layout final:
As noted in the link:
You will:
NOT be able to move the field to the Report Filters area
NOT be able to add multiple copies of a field to the Values area.
Extra items might be created in the pivot tables, such as cities
appearing in all regions, with zero values.

Excel: max() of count() with column grouping in a pivot table

I have a pivot table fed from a MySQL view. Each returned row is basically an instantiation of "a person, with a role, at a venue, on a date". The each cell then shows count of person (lets call it person_id).
When you pivot this in excel, you get a nice table of the form:
| Dates -->
--------------------------
Venue |
Role | -count of person-
This makes a lot of sense, and the end user likes this format BUT the requirement has changed to group the columns (date) into a week.
When you group them in the normal way, this count is then applied in columns as well. This is, of course, logical behaviour, but what I actually want is max() of the original count().
So the question: Does anyone know how to have cells count(), but the grouping perform a max()?
To illustrate this, imagine the columns for a week. Then imaging the max() grouped as a week, giving:
Old:
| M | T | W | T | F | S | S ||
--------------------------------------- .... for several weeks
Venue X |
Role Y| 1 | 1 | 2 | 1 | 2 | 3 | 1 ||
New (grouped by week)
| Week 1 | ...
---------------------------
Venue X |
Role Y| 3 | ...
I'm not on my pc, but the steps below should be broadly correct:
You should be able to right click on the date field on pivot table and select group.
Then highlight week, you may have to select year also.
Lastly right click on the count data you already have and expand the summarise by, and select max.

Export records to excel sheet

I've got a table in access looking like this,
Category | Subcategory | Userdate (mm/dd/yyyy) | Color
I want to export this to an excel file where the Categories and Subcategories will be placed in column A and B respectively. However the Colors will be placed by month (Userdate), 12 months meaning Columns from C to N. So what I want to do is place the records from colors in different columns depending on the month (Userdate).
What is the best way to go about doing this? Create a recordset and loop through it? I reckon this will be a bit slow when rows exceed the 40k which is possible.
I could also make the table have Month columns like:
Category | Subcategory | January | February | etc...
So I could just export it just like that but seems to me that's just a bad way of making a table.
it sounds like you want a crosstab query:
TRANSFORM First(Table1.Colour) AS AColour
SELECT Table1.Category, Table1.Subcategory
FROM Table1
GROUP BY Table1.Category, Table1.Subcategory
PIVOT Format([Userdate],"mm-mmm");
You can transfer to Excel programmatically with DoCmd.TransferSpreadSheet

Resources