Get total from excel records - excel

I have a problem with csv for example, i have multiple rows with a date and a price with more of the same date and time for example
01-01-2015 10:00, 10.00
01-01-2015 11:00, 12.00
01-01-2015 12:00, 9.00
02-01-2015 11:00, 4.00
02-01-2015 13:00, 6.50
There are thousands of rows like this and what i try to accomplish with excel is to get the total from all the days so with the example data i would want the following result:
01-01-2015, 31.00
02-01-2015, 10.50
Does anyone know an ease way to accomplish this (keep in mind that the file involves thousands records)
I also hope that i used the right forum for this problem, i couldn't find a specific forum for excel or office on this website

Open a new column. assuming that your first date on is in cell A2 (If it is on A1 then insert header first. it will be important to the pivot table) and your first price is on cell B2 the on C2 enter =rounddown(A2,0) this will extract the date with no hour.
Then, insert a pivot table. select all your data and on the insert ribbon press insert pivot table. Drag all the fixed date for the row and the price drag for the value. If the values are on count, change the values from count to sum by clicking the definition field.

Related

Incrementing a Cell Reference By x

I am trying to average a large data set within Excel where there is data by 30 minute periods for each day of the month. I have a header for 'start date' and 'Start time' which displays 00:00:00 - 23:30:00 for each day, with the data in question in columns to the right. I am trying to develop a formula which averages data which concerns 00:00:00 - 11:30:00 for each day and 12:00:00 - 23:30:00 for each day (AM:PM).
I have one header for AM values and another for PM values, and Im looking to average both these elements for each day of the month
I have used the following formula which does work:
=AVERAGE(OFFSET(C6,24,0,-24))
This formula capture the range from 00:00:00 - 11:30:00 and averages it like I want, but when I drag the formula down to the next cell, C6 increments to C7, but I want it to increment by 48 each time, meaning C6 should become C54. This means when I drag it down each time it will average the AM values for 02/01/2019 and so on.
Is there any way the cell reference in the above formula can increment by 48 instead of 1 each time it is dragged down into another cell?
Sample Data
Expected output
I made up a dataset kind of like yours:
The formula I've used in F4 to obtain the average of values, when date is '01/01/2019' and time is AM, is AVERAGEIFS:
AVERAGEIFS function
My formula is:
=AVERAGEIFS($C$6:$C$101;$A$6:$A$101;E4;$B$6:$B$101;"<"&0,5)
You can use it and just drag down. As you can see in the image above, the formula returns 27,07
The formula will work only with AM because the criteria is "<"&0,5. In the column where you want to do the average of PM times, we would use the same, but changing criteria to ">="&0,5, this means:
=AVERAGEIFS($C$6:$C$101;$A$6:$A$101;E4;$B$6:$B$101;">="&0,5)
Hope you can adapt this to your needs.
NOTE: Because your data is in a Pivot Table (you never mentioned that), if the Pivot Table changes, you'll neeed to adapt the formula. A solution would be using ranges from row 6 until last one, so the formula will take always all the rows. Remember to not show total row or it may affect the result.
OPTION 2: In case you can add an extra column to original data (not in the Pivot Table), maybe this can help a lot.
I've used same data than before, but I added an extra column, named AM/PM with a formula on it:
=IF(B6<0,5;"AM";"PM")
It looks like this:
Then I created a Pivot Table based on it, with a configuration:
Field Start date to section of rows.
Field AM/PM to columns.
Field VALUE to values section, but instead of suming up, I did average operation.
I get this on my Pivot Table:
As you can see, AM for 01/01/2019 is 27,07 (the oher numbers are based on random numbers I made up).
Hope this can help.
If you absolutely must go with the AVERAGE(OFFSET()) solution I would have a 'helper' cell (in this case J6) with 1 in it, then J7 have =J6+48, then the main formula could be
=AVERAGE(OFFSET($C$6,J6,0,24))
Then when you copy the formula down, you'll also need to copy down from J7.
The Rows argument is purpose built for what you want to do. Going to efforts to change the reference cell defies this purpose.
Edited because I missed the AM/PM split:
I think, however, AVERAGEIFS() will fit your requirement better. This takes the average of all values in column C where the date in column A matches that in cell G6 (Change this to wherever your output is). This will avoid errors should any of your dates have any half hour periods missing.
=AVERAGEIFS($C:$C,$A:$A,G6,$B:$B,"<"&TIMEVALUE("12:00:00"))

Excel : MAX number in any 30 day period

I`m trying to work out a formula, on how to get the MAX amount, for any 30 day consumption period, for a certain item, when all the criteria are in one data table. See picture below. Date is in column A.
I have table with a formula where I copy and paste data manually
=SUM(IF([Date]>[#Date]-30,IF([Date]<=[#Date],[Amount])))
At the end- I would like to have the list of all the item numbers in one column and the one next to it should have - max amount used in any 30 day period.
In my Master file I have around 1300 Item numbers, which is time-consuming to get the MAX data on-by-one.
Can anyone help?
Instead of copy and paste, you can do a pivot table on the data in the first screenshot. Use the dates in rows, use the Amount in values. If you want to do this for item numbers, use them in rows before the date.
You should then have a nice table with dates and amounts per date, no duplicate dates.
If you don't want to use pivot tables, create the date column manually, without duplicates, and use a Sumifs formula to sum the data from the original sheet. Enter the start date, then use the fill handle and drag down. That will automatically increment the date. Let's say the dates are in column A, first row has labels, then use in B2 and copy down:
=sumifs('the other sheet'!H:H,'the other sheet'!A:A,A2)
Next, in C2 you can use a MAXIFS function along the lines of
=MAXIFS(B:B,A:A,"<="&A2-30)

Get total figure from multiple figures in Excel

I have a spread sheet with data on it that I am trying to add up to get a grand total for each week and month.
The data is displayed within a single sheet/tab on excel that has a date column and goes back to lets say 1st December. What im trying to do is add each total up to basically get a weekly and monthly figure instead of a figure for each individual day.
For example sake lets say im trying to add up the weekly total of apples picked for each person.
A1 = EMPLOYEE ID
B1 = DATE APPLES WERE PICKED
C1 = how many apples were picked on that 1 day
The hard bit is there is 100 people each day picking these so its hundreds of lines of data.
Im wanting to get a total weekly amount for each person but its hard to do as there are too many employees so I cant do it by manually working it out
Output basically looks like that
A1 20332332
B1 FROM 10/2/16 - 17/02/16
C1 312 (APPLES PICKED)
A2 888865
B2 FROM 10/2/16 - 17/02/16
C2 222 (APPLES PICKED)
You must try to do it with Pivot Table (here I use Excel 2010, but it exist in previous releases)
First select your data and go to the insert pane:
Then Ok
Finally check the date and "number of apples" fields:
See Excel pivot table range and cross reference for more.
To better meet your need, add 2 columns, one being "month", the other being "year" and calculated from DATE. You must put the "number of apple" column in the "sum" subwindow (lower left).
Here is what I get for example:

Average each hour's meter readings

I have two columns of data with five or six meter readings each hour:
time (HH:MM:SS) (C3:C103) meter readings (D3:D103).
I would like to average each hour's readings to condense the data down to one averaged meter reading per hour.
I tried =Averageif(C3:C103,Hour=10,D3:D103) but clearly have something wrong.
Assuming you have just time values in C3:C103 (not with dates) then you could get your results like this:
List the numbers 0 to 23 in F2 down then use this formula in G2 copied down
=AVERAGEIFS(D$3:D$103,C$3:C$103,">="&F2/24,C$3:C$103,"<"&(F2+1)/24)
That will give you a table with the results for each hour
You can do this with one formula.
The following is an Array formula (need to press Ctrl + Shift + Enter, instead of just Enter to add it), and works for anything in the 10 o'clock hour.
{=AVERAGE(IF(HOUR(C3:C55)=10,D3:D55))}
Again, type the formula without the curly brackets then hold down Ctrl + Shift then press Enter
Basically the formula looks at the hour of each entry, checks to see if it is 10, then averages the adjacent numbers if the previous condition is true.
ALTERNATIVE:
You don't need a formula at all, (or any helper columns) if you just use a pivot table.
Select your data
Add your time column to the Row Labels section of the pivot table
add your meter readings column to the values section
In the Pivot table right-click on the meter readings data and select Show Values As ... Average in the menu.
In the pivot table, right-click on the time data and select the group option. In the option box select Hours only, and click OK.
That will give you the average for each hour without any additional formulas. It's also nice because it requires little maintenance after you have created, other than refreshing each time you get new data.
solution for my comment earlier:
This is easily done with a pivot table. First, break down the HH:MM:SS column down into an hours column only (since you want it grouped by hours). Then put all of the data into a pivot table, and put the 'hours' column in the row labels, and the meter readings (make sure to do an average, not a count) in the values field. This should be what you need.

Getting average of data with multiple entries for a single date using pivot table in Excel

I have tried this, but I am unsuccessful. I have the data dump in an excel sheet (Excel 2010). The first column has month. The second has the dates. The third column has numerical data. I have applied filters on each column to get the data on the Pivot Table. There are entries for each date. There are sometimes multiple entries for a single date. Now, when I run the Pivot, I get the proper sum, but when I select average, the average is accurate only for the single entries associated with a date. I need to calculate average of multiple data entries for a single date. Here is an example:
November 11/1/13 30
November 11/2/13 25
November 11/3/13 20
November 11/3/13 25
Now, when I run the Pivot table and select to average the data, it calculates the average as (30+25+20+25)/4 = 20 (since there are 4 entries, so the sum gets divided by 4).
This is not desirable.
I require the calculation to be made as taking the 3rd and 4th entry as one for the date 11/3/13. So, the required output is (30+25+(20+25))/3 = 33.33.
I hope the example gives an clear idea of the requirement. I need a solution for this. How do we modify the Pivot so that the average is calculated not based on just the number of entries, but the average is calculated for the number of days.
Create the pivot table described by Ron (with Sum only, not Average), then copy & paste special (values) this pivot table, then pivot that for averages.
Put your dates in the "Row Labels" area. It will Sum and Average by Date
Edit: To get the average of the sum of the daily values, you can either enter an Average formula someplace for the Pivot Table Sum Column, or you could use the following array-entered formula:
=SUM(Values)/SUM(1/COUNTIF(Dates,Dates))
Where Dates is the range where you have your list of Dates (on the original data sheet) and Values is the range where you have your original list of Values.
To array-enter a formula, after entering
the formula into the cell or formula bar, hold down
while hitting . If you did this
correctly, Excel will place braces {...} around the formula.
SUM(1/COUNTIF(Dates,Dates)) will return a count of the Unique dates, so it will return 3 for the dates in question in your example.
This proposed solution uses a working column named: Value (U)
Assuming that your data is located at [B4:B8].
Add a working column at [E4:E8]
Enter this formula at [E5:E8]:
= IF( COUNTIF($C$5:$C5,$C5) > 1, 0,
SUMIF($C$5:$C$8,$C5,$D$5:$D$8) )
Then use the working column Value (U) to sum and average the values, also add Value (U) as Page Field to filter out the Value (U)=0.

Resources