Sum data in a column based on another column Report Builder - Sharepoint - sharepoint-2010

I have a project where I have to report stop times of different production lines.
I have to make a report file with Report Builder and my problem for the moment is that I have to sum all the stop times that where entered for the same line.
The stop times are entered on SharePoint (using a form from InfoPath) and stored in a SharePoint List.
My data list is presented like this:
LINES ---- TIME(min)
Line 1 ---- 4
Line 2 ---- 2
Line 1 ---- 3
Line 3 ---- 8
Line 4 ---- 9
Line 2 ---- 2
Line 3 ---- 4
Line 5 ---- 5
Line 5 ---- 8
I want to sum all the stop time for each line (In my report generated with Report Builder). So I'll have "Line1 -> 7", "Line 2 -> 4",...
Do you have any idea how I could do it?
Ask if you need more informations...
Thank you for your help!

This should be fairly easy; set up a table drawing the data in exactly that format, then right click the "Details" row in "Row Groups" at the bottom of Report Builder and click "Group Properties". Press Add, and select your "Lines" field, then press OK. Finally, change the expression populating the "Time" column in your table to =SUM(Fields!.Value).
What this will do is collapse the table to show one line per distinct value it finds in the "Lines" column, then tells it to simply add all the values it collapses together. The effect will be that it sums up the Time column for each distinct value it finds in the Lines column.

Related

Using VBA to create a grid from 3 spreadsheets with the row, column, and values

I have three excel spreadsheets. The first has the values that are to be assigned to a new excel spreadsheet. The second has the column that the data belongs in. The third has the row that the data belongs in.
It looks something like this:
Data Value:
1 5 7 9
2 2 6 8
Column Number:
1 2 3 1
2 3 1 2
Row Number:
1 2 3 2
4 4 3 1
How can I combine all of this information to create a single spreadsheet that contains the values in a format like this:
Column
1 2 3
Row
1 1 8 0
2 9 5 0
3 6 0 7
4 0 2 2
I have tried to do it by using loops in vba, but I am a beginner and I am having some difficulty.
I know that I need to use a loop that checks the row and column that the data is supposed to be in against the row and column for each iteration. I am just not sure how to go about doing that.
Assuming these are different sheets in the same workbook (if not - create a new workbook and copy the sheets over). I assume that on each sheet, the same range of cells is used (for example A1:D2 in all 3 cases with the values on the first sheet, the column numbers in the second and the row numbers in the third). You can dispense with VBA entirely at the expense of using some complicate formulas (inspired by this excellent article: http://exceluser.com/blog/1043/how-to-create-two-dimensional-lookups-in-excel-formulas.html )
Step 1. Add a fourth sheet and in A1 add the formula
=CONCATENATE(Sheet3!A1,"_",Sheet2!A1)
and copy it over the appropriate range (e.g. A1:D2). This will give you things like 2_1 which tell you that the corresponding entry in sheet 1 belongs in row 2 column 1. Name this range "location" (formula tab - define names option)
Step 2 - Decide where you want to hold the data (I'm assuming it is in sheet 4 for simplicity) And add the row numbers (1-4) and the column numbers (1-3) as labels. In my case the row labels are in A5:A8 and the column labels in B4:C4 (see the screenshot below). Then in the upper left corner of the values to be filled in (B5 in my case) enter the following formula (suitably adjusted to match your ranges):
=IFERROR(INDIRECT(ADDRESS(SUMPRODUCT(ROW(location)*(location = CONCATENATE($A5, "_",B$4))),SUMPRODUCT(COLUMN(location)*(location = CONCATENATE($A5, "_",B$4))),,,"Sheet1")),0)
and copy it over the intended range. Be careful with the dollar signs - this formula mixes row absolute and column absolute references in an essential way. Somewhat oddly, it actually works:

Formula help to extract rows meeting multiple criteria

I have a spreadsheet with over 600k rows. I need to extract data based on multiple criteria and grab only the latest change numbers of each.
So an item number may have multiple entries based on quarter start dates and desc codes because it's been revised several times in that quarter but I just want the most recent one (highest change number) and that row returned or marked in a new column to then filter out.
Hope that makes sense.
I have the following columns. Column A (Desc Code) which has 12 different codes in it, then Column B (Item Number several thousand), Column C (Period Begin, Start of the quarters dating back to 1998) and then a Column H (Change Number). I need to basically pull "Each" row containing the highest change number, for each Item Number in each Period it was available for each code.
So basically The change numbers vary depending on how many changes the Item Number had in the quarter.
And each time there was a change there is a change number for each Item Number for Each Desc Code (12 rows for each).
Thanks.
You lost me somewhere near paragraph 4 but let's simplify things. If you just had two columns -- Item Number and Change Number -- and you had a record for each change, you could just use Excel's subtotal feature: at each change in Item Number, show the MAX of Change Number.
Use the same logic for your situation. Create a new column that combines your "category" criteria (item & desc, or item & period, or whatever), sort by it, then subtotal against that new column and return MAX of Change Number.
Edit:
Item Period Change
100 1 1
100 1 2
100 1 3
100 2 1
100 2 2
I'm not sure if this is how your data looks but let's use it as an example (and's lets forget about Desc Code for now). If you want to find the latest change by item and period, create a new column by combining the Item and Period columns. For example, insert a column (C) and use the formula: =A2&"_"&B2. Now your data looks like this:
Item Period I&P Change
100 1 100_1 1
100 1 100_1 2
100 1 100_1 3
100 2 100_2 1
100 2 100_2 2
Now use Excel's subtotal feature (in the Data menu/ribbon, not the worksheet formula). Here's an example of what this looks like:
In your scenario, for the "At each change in" box, pick your new column (C), since that uniquely identifies the category you trying to identify (item AND period). "Use function" = Max. "Add subtotal to" = your Change Number column.
Click [OK] and Excel will add a new row with the maximum Change Number for each.

SSRS Comparing 2 rows (new vs old) and highlighting the differences / changes

I have a report which gives the current state of an item, and the previous state of an item and I want to display both rows and highlight the differences. For example:
STATUS ORDER# NAME ADDRESS QTY PRICE TOTAL
new 255 Joe 1 Main St 2 5 10
old 255 Joe 1 Main St 4 5 20
new 256 Matt 100 Green Ave 5 5 25
old 256 Matt 65 Blue St 5 5 25
So for order 255 I'd like to highlight the QTY and TOTAL values since they changed.
For order 256, I'd like to highlight the ADDRESS value.
Does anyone know how I can accomplish this?
Thanks a bunch in advance!!
In the textbox properties go to the Fill tab. For fill color enter an expression like this:
=iif(Fields!GroupID.Value=previous(Fields!GroupID.Value)
and Fields!Spouse.Value<>previous(Fields!Spouse.Value)
,Parameters!Color.Value,Nothing)
Change "GroupID" to be your Order# and change the "Color.Value" to the highlight color you want.
Note: This will only highlight the second row when it is different from the first, there is no way to highlight the first row as well because there is no "Next" function, just the Previous function. You can use this to either highlight just the cells that are different or the entire row.

Displaying a timeline in crystal reports or excel

I have an application that keeps rent periods of a parking lot. I have a SQL database with this information:
idLot dateFrom dateTo
------------------------------------------
1 01/03/2011 30/07/2011
2 01/01/2011 30/05/2011
3 01/02/2011 30/07/2011
6 01/02/2011 30/06/2011
And I need to display the information like the image below.
1
I cannot achive the goal with Excel or Crystal Reports. I also use ComponentOne FlexGrid. Any ideas?
Thanks in advance.
It's not the prettiest option, but you can do this in Excel using the Sumproduct() function. In the screenshot below, the sumproduct goes through each line of your datatable and does 3 things (the selected cell is B17 by the way):
It determines whether each row has the idlot it is looking for (evaluates to true/false)
It determines whether DataFrom is <= the column of your display table (evaluates to true/false)
It determines whether DataTo is >= the column of your display table (evaluates to true/false).
This results in a 0 or 1 in each cell of your display table. This is close, but not exactly what you're looking for. I then added some conditional formatting:
If the result of the equation was 0, then the cell's font is white.
If the result of the equation was 1, then cell's font and background are both green.
When you apply the conditional formatting to the entire graph, you get the last 2 rows, which is green for occupied and white for unoccupied.
The only remaining problem is how to account for a changing number of rows in your table. This can be solved by just setting the ranges in your equation to a very high number.

Excel countif Pulling apart a cell to do different things

Excel 2007
I have a row of cells with variation of numbers and letters (which all mean something.. not random.)
It's basically a timesheet. If they take a sick day they put in S, if they take a partial sick day they put in PS. The problem is they also put in the hours they did work too. They put it in this format: (number)/PS.
Now if it were just letters I could just do =countif(range,"S") to keep track of how many s / ps cells there are. How would I keep track if they are PS where it also has a number separated by a slash then PS.... I also still need to be able to use that number to add to a total. Is it even possible or will I have to format things different to be able to keep track of all this stuff.
Assuming this is something like what your data looks like:
A B C D E
1 1 2 S 4/PS 8
...then you could do this:
1- add a column that just totals the "S" entries with a COUNTIF function.
2- add a hidden row beneath each real data row that will copy the numerical part of the PS entries only with this function in each column:
=IF(RIGHT(B1,2)="PS",IF(ISERROR(LEFT(B1,LEN(B1)-SEARCH("/",B1)-1)),"",INT(LEFT(B1,LEN(B1)-SEARCH("/",B1)-1))),"")
3- add another column to the right that just totals the "PS" entries by summing the hidden row from step 2.
3- add another column that totals everything by just summing the data row. that will ignore the text entries automagically.
4- have a grand total column that adds those three columns up
If you don't want to see the "S" and "PS" total columns, you can of course just hide them.
So in the end, the sheet would look like this:
A B C D E F G H I J
1 1 2 S 4/PS 8 1 4 11 16
2 4 <--- hidden row
HTH...
My quick take on this is:
pass the cell value into a CSTR function, so no matter what is entered you will be working with a string.
parse the information. Look for S, PS, or any other code you deem to be valid. Use Left or Right functions if you need to look at partial string.
check for number by testing the ascii value, or trying a CINT function, which will only work if the string can be converted to integer.
If you can show a sample of your cells with variation of numbers and letters I can give you more help. Hope this works out.
-- Mike