I'm using query to get data from a database. My problem is that the arrangement of data is not so user friendly.
My data comes in the following format, .. only a lot bigger table:
Measurand Date Trunk 1 Trunk 2 Trunk 3 Trunk 4
a 1.1.2012 00:00 Value.a.1 Value.a.2 Value.a.3 Value.a.4
b 1.1.2012 00:00 Value.b.1 Value.b.2 Value.b.3 Value.b.4
c 1.1.2012 00:00 Value.c.1 Value.c.2 Value.c.3 Value.c.4
a 2.1.2012 00:00 Value.a.5 Value.a.6 Value.a.7 Value.a.8
b 2.1.2012 00:00 Value.b.5 Value.b.6 Value.b.7 Value.b.8
c 2.1.2012 00:00 Value.c.5 Value.c.6 Value.c.7 Value.c.8
a 3.1.2012 00:00 Value.a.9 Value.a.10 Value.a.11 Value.a.12
b 3.1.2012 00:00 Value.b.9 Value.b.10 Value.b.11 Value.b.12
c 3.1.2012 00:00 Value.c.9 Value.c.10 Value.c.11 Value.c.12
I want to write a formula or do some voodoo to make it look like:
Date a b c
1.1.2012 00:00 Value.a.1 Value.b.1 Value.c.1
1.1.2012 00:00 Value.a.2 Value.b.2 Value.c.2
1.1.2012 00:00 Value.a.3 Value.b.3 Value.c.3
1.1.2012 00:00 Value.a.4 Value.b.4 Value.c.4
2.1.2012 00:00 Value.a.5 Value.b.5 Value.c.5
2.1.2012 00:00 Value.a.6 Value.b.6 Value.c.6
2.1.2012 00:00 Value.a.7 Value.b.7 Value.c.7
2.1.2012 00:00 Value.a.8 Value.b.8 Value.c.8
3.1.2012 00:00 Value.a.9 Value.b.9 Value.c.9
3.1.2012 00:00 Value.a.10 Value.b.10 Value.c.10
3.1.2012 00:00 Value.a.11 Value.b.11 Value.c.11
3.1.2012 00:00 Value.a.12 Value.b.12 Value.c.12
I know it's a horrible display, but I can't insert pictures due to lack of points.
The laziest option I can see here would be to create a pivot table with your whole table as the input range, setting trunk1-trunk4 as data fields (in that order), with measurand as a column field and date as a row field. This will give you the layout you want, as long as there is only 1 value per measurand per trunk per date.
As long as you don't keep adding lots of new trunks it shouldn't be too much work to keep it updated. I don't think there's any easy way of adding loads of data fields in one go unless you resort to a bit of VBA.
Related
I have 2 columns in excel.
Column 1 indicates 'pieces' (of delivery) and the other indicates 'processing time'.
I typed these in by hand because i was given them on a sheet of paper, so there is no maths formula visible.
Is there a way to get Excel to tell me how 'Process time' is being calculated because I really can't figure it out.
--- Example of situation ---
Total pieces | Pro Time (MM:SS)
40 | 00:21
3 | 00:01
12 | 00:04
43 | 00:22
I am trying to count the unique number of entries in a pivot table.
My pivot table is displayed as such:
U V W X Y Z AA
PN# Customer Offer# Date $ QTY Sum of Offer#
123456 00000001 157815 09.06.2015 16,3 25 1
123456 00000001 157815 09.06.2015 31 10 1
123456 00000001 157815 09.06.2015 43,5 5 1
123456 00000001 157815 09.06.2015 65,3 1 1
123456 00000002 156682 31.03.2015 10 140 1
123456 00000003 157505 19.05.2015 20 25 1
123456 00000004 156925 13.04.2015 10,04 1000 1
123456 00000004 157459 18.05.2015 9,44 1000 1
123456 00000005 158036 23.06.2015 16,3 25 1
123456 00000006 157064 20.04.2015 10,8 100 1
123456 00000006 157064 20.04.2015 12,5 50 1
123456 00000007 156616 26.03.2015 9,5 700 1
123456 00000007 157264 29.04.2015 9,3 450 1
This is basically a list of order offers we make to customers. I want to analyse this to see how often we offer products etc
So far, I have the number of total offers using:
=SUMPRODUCT(--($U$5:$U$7000=U5),$AA$5:$AA$7000)
this shows for one article number, how many offers there are. But of course, it counts the duplicates as well.
So I am testing with COUNTIF:
=SUMPRODUCT(1/COUNTIF($W$5:$W$45,$W$5:$W$45)) (sample fixed range - normally will goto row 7000)
and this works for a fixed range.
So, my question is - how to combine those two? - so that I can see for one Product Number PN#... the unique number of offers made. I can of course then use the same fomula to see unique number of customers, which at present is also not possible.
Thanks!
I want to divide column L according to specific time ranges and put it in Another column.
Time ranges:
00:00 - 05:00 => 0
05:00 - 10:00 => 1
10:00 - 15:00 => 2
15:00 - 20:00 => 3
20:00 - 00:00 => 4
I've tried with this formula in excel, but I don't know what I'm doing wrong:
=IF(time(0;0;0)<L2<=time(5;0;0); 0;IF(time(5;0;0)<L2<=time(10;0;0); 1;IF(time(10;0;0)<L2<=time(15;0;0); 2;IF(time(15;0;0)<L2<=time(20;0;0); 3;IF(time(20;0;0)<L2<=time(0;0;0);4))))).
Example of data and expected output:
L K
00:00 0
00:00 0
07:50 1
00:00 0
00:00 0
06:16 1
00:00 0
14:20 2
15:50 3
06:10 1
16:24 3
Thx!
In column K use this,
=IF(L2<=TIME(5; 0; 0); 0; IF(L2<=TIME(10; 0; 0); 1; IF(L2<=TIME(15; 0; 0); 2; IF(L2<=TIME(20; 0; 0); 3; 4))))
An IF formula stops evaluating once it finds something that is true. If a time is less than 5:00 AM then it is true and zero is returned. The next check (for less than 10:00 AM) does not need to check if it is also greater than 5:00 AM; that was done previously and you wouldn't be checking the 10:00 AM criteria unless it was true.
Alternates:
=INT(K2/TIME(5; 0; 0))
=INT((K2*24)/5)
I have an Excel 2007 spreadsheet with date entries in this format m/d/yyyy h:mm (one cell). I would like find the hourly and daily average of all the columns of this spreadsheet and save each time aggregation to a new worksheet.
The data is recorded every ~10 minutes, but throughout the dates of data collection there was some time slips. Not every hour has the same number of rows. Also, the ending minute is either 0 or 6 depending on the time correction.
What would be a good way to approach this task within Excel 2007? It seems like this might be possible with a pivot table if I can create a formula that will select the correct range for the timestamps. Thanks.
For example, an date time entry in TIMESTAMP, 10/31/2012 0:06 which is in one cell.
TIMESTAMP Month Day Year Hour Min Rain_mm Rain_mm_2 AirTC AirTC_2 FuelM FuelM_2 VW ... there are ~16 variables (total) after the data time
10/31/2012 0:06 10 31 2012 0 06 0 0 26.11 26.08 2.545 6.4 0.049
10/31/2012 0:16 10 31 2012 0 16 0 0 25.98 25.97 2.624 6.6 0.049
10/31/2012 0:26 10 31 2012 0 26 0 0 24.32 23.33 2.543 6.5 0.048
10/31/2012 0:36 10 31 2012 0 36 0 0 24.32 23.33 2.543 6.5 0.048
10/31/2012 0:46 10 31 2012 0 46 0 0 24.32 23.33 2.543 6.5 0.048
10/31/2012 0:56 10 31 2012 0 56 0 0 25.87 25.87 2.753 7.3 0.049
10/31/2012 1:06 10 31 2012 0 06 0 0 25.74 25.74 2.879 8.1 0.051
## The above is just over one hour of collection on one day ##
...
## Different Day ### Notice Missing Time Stamp
11/30/2012 0:00 11 30 2012 0 06 0 0.1 26.12 26.18 2.535 6.4 0.049
11/30/2012 0:10 11 30 2012 0 16 0 0.1 25.90 25.77 2.424 6.6 0.049
11/30/2012 0:20 11 30 2012 0 26 0.1 0.2 24.12 24.43 2.542 6.4 0.046
11/30/2012 0:30 11 30 2012 0 36 0.1 0 24.22 22.32 2.543 6.5 0.048
11/30/2012 0:50 11 30 2012 0 56 0.1 0.2 26.77 25.87 2.743 6.3 0.049
11/30/2012 1:00 11 30 2012 0 06 0 0 24.34 24.77 2.459 5.1 0.050
## so forth on so on ##
After clarification of the requirement for daily averages edited to cover both daily and hourly averages:
Add a column (here B) for ‘H’ (ie hour) with =HOUR(A2) copied down.
(Note: Though formatted to show only m/d/y content of ColumnA is, in line with title, assumed to be all of mm/dd/yyyy hh:mm. Makes existing columns [with names jumbled] Month, Day, Year, Hour redundant).
Select data range.
Data, Subtotal, At each change in: TIMESTAMP, Use function: Average, Add subtotal to: check only columns G and to the right, OK.
Uncheck Replace current subtotals in Subtotal and apply At each change in: H, Use function: Average, and Add subtotal to: as before, OK.
Replace =SUBTOTAL(1, in Min column with =MIN( .
Delete ‘spare’ Grand Average row.
Reformat as required.
Hopefully this will be achieved and is what is required!:
Note midnight 'tonight' is counted as within first hour of tomorrow.
I had a similar need and worked it out this way:
Add a column for Date (assuming your dd/mm/yyyy hh:mm:ss data is in cell A2)
=DATE(YEAR(A2),MONTH(A2),DAY(A2))
Add a column for Year. If you have weeks from a single year, the year column can be neglected.
=YEAR(A2)
Add a column for Week Number
=WEEKNUM(A2)
Add 2 pivot tables, 1 for daily and 1 for weekly analysis.
Choose fields "Date" and the quantities you want. Put "Date" in the Rows section and sum/average of values in the Values section. You will get a date wise sum/average of the values you need.
In the weekly pivot table, do the same as above, just add "Year" and "Week no" in the Rows section instead of "Dates" as in above.
Hope this helps
I have table as
Id Name Date Time
1 S 1-Dec-2009 9:00
2 N 1-Dec-2009 10:00
1 S 1-Dec-2009 10:30
1 S 1-Dec-2009 11:00
2 N 1-Dec-2009 11:10
Need query to display as
Id Name Date Time
1 S 1-Dec-2009 9:00
1 S 1-Dec-2009 11:00
2 N 1-Dec-2009 10:00
2 N 1-Dec-2009 11:10
My backend database is MS Access and using VB6 for Max and Min time
I would make an additional two [int] columns, say hour and minute and then use an MS Access query to sort them. It would be MUCH easier to call that in VB. The query itself would be something like the following:
SELECT * FROM YOURTABLE ORDER BY id, hour, minute;