I am using the sum aggregate to calculate some totals in an angular ui-grid.
The totals get displayed just fine but I could not figure out how to change the label that gets preceeds to the total.
if the total is 5000 for example, the footer will display : total : 5000
How do I remove the word total ? I see it in the source but I cannot figure out how to change it without changing the source.
Thanks
I found the 'undocumented' (http://ui-grid.info/docs/#/api/ui.grid.class:GridOptions.columnDef) property that can be used for this purpose : aggregationLabel
you can remove that just bu adding this function
$scope.hideAgregationChar = function( aggregation ){
aggregation.rendered = aggregation.value;
};
and in your grid definition add this
customTreeAggregationFinalizerFn: $scope.hideAgregationChar,
or if you wan to change the word to another one just change the cell templates like this
cellTemplate: '<div class="ui-grid-cell-contents">\'Total\' (capital \'T\') {{col.getAggregationValue() | number:2 }}</div>'
that will change the total to Total for example.
You have to include just footerCellTemplate as below for that particular column which you need to aggregate sum.
footerCellTemplate: '<div class="ui-grid-cell-contents">\Total:\ {{col.getAggregationValue() | number:2 }}</div>'
for example, the above line will change the total to Total.
Related
This is fake data for question purpose
sorry for using images rather than markdown table but it would have been very hard to explain if i used markdown table
This is my DATA named Work Sheet where Y and Z is always going to be array and both have corresponding value. EX: for row2:
WBC = 33
this is my stats Sheet where i need to get value of Parameter[x] based on Day & Disease
This is where i took B$151 to B166 and now need value of it from DATA!Z2:Z (Lab values) based on name of parameter,Disease , Day .
where selected cell (B169) has formula:
B166 = RBC
A169 = DAY 1
B1 = Gastroenteritis
=MODE(INDEX(SPLIT(query(DATA!$E$2:$Z, "Select Z where Y contains '"&B$166&"' and E contains '"&$A169&"' and X contains '"&B$1&"' limit 10"),",",1),0,B$167))
Now problem is in DATA sheet user can input item at any index. right now i am using fixed index B$167, but it will break entirely and give wrong results if user changes index of that term. is there any way where i can replace B$167 with dynamic like searching that parameter name in that E,X (Day, Disease). and get index of it and change B$167 with it
i have tried using match search index and pretty everything in my knowledge but problem was Match function only takes single cell and column, so i can't give entire DATA!Y2:Y and split them and then get index. but did not work.
this was the limit of solution i was able to reach.
where A5 = WBC or any in regards
given Y2 becuase was getting error on Y2:Y
=MODE(INDEX(SPLIT(FLATTEN(FILTER(DATA!Z2:Z,DATA!X2:X=B4, DATA!E2:E=C4)),","),0,MATCH(A5,SPLIT(FLATTEN(DATA!Y2),","),)))
but using this will only give index if it is in y2 and also there is no garranty
that parameter is going to be in same index in all cells all the time
i have tried to add 4th condition to Filter on above formula such as search, regexmatch and all but i was not able to solve.
CURRENT SOLUTION: EDIT2
[NEW SHEET][1]
[1]: https://i.stack.imgur.com/rNDh8.png
right now i have did kind of like this and it will be ok if i can combine those 2 (Disease, value) into single cell like this.
RBC: 11
WBC: 33
so i don't need to manually add disease name and Value column each time. i googled but found that i can't skip columns in formula output
so i moved to this.
EDIT2:
i solved this way, now everything is automatic.
where 1 = n
=INDEX(UNIQUE({A2:A}),1)
I have a simple table.
Column A are dates (rows 2 to 100) that reflect approximately the next 3 months.
Column C are percentages that range from 0 to 1 (i.e. 0% to 100%). The %s are derived from a =FORECAST function.
I want to query a date in column A based on a value of 100% in column C. However, the QUERY function does not work because it's reading the =FORECAST formula in column C rather than the text or value of "100%" itself. (In other words, if I remove the =FORECAST formula and type in the string "100%", the query works.
How can I pull the date value in Column A and keep the formulas used in column C?
This sounds like a lookup to find the value in column A on the first row where column C contains the value 100%. Try this:
=vlookup(100%, { C2:C, A2:A }, 2, false)
In the event multiple rows in column C may contain 100%, and you want to get all such dates, try this:
=filter(A2:A, C2:C = 100%)
In the event your forecast() numbers do not produce exact percentages but figures like 100.04%, use this:
=filter(Forecast!A2:A, round(Forecast!C2:C, 2) = 100%)
Thanks to everyone who contributed. My workaround was replacing the = sign with a > sign, as shown:
=QUERY(StageHist!A:H, "SELECT A WHERE C>.99")
since I couldn't figure out how to make the 100% figure an exact 100%. Apparently the =FORECAST formula is designed to give a result with 8 or 9 digits to the right of the decimal. (Although I'm sure that I could nest a =ROUNDing function inside of FORECAST and get an exact 1.0 value. (A project for another day!)
I am currently working with Google Forms and want to rearrange the way the responses are being displayed on the "Response Sheet". The only way I can think of doing this is by importing or moving the data to another sheet that would select and transpose certain columns if Column A contains key value.
This is what I'm seeing as part of the input and would like to see as the output if Column A Contains certain text:
Input & Output
Thank you in advance for your help!
O.K.
I rewrite headings a2:e2,
I take whole first five columns without headings e3:e6
I display content of columns A,B,F,G,H for all the rows that have 'A1' in column 1
I take tables built in point 1 and 2 together and sort them by first column
My solution is here:
https://docs.google.com/spreadsheets/d/1n7Ppd8v75mb3qrnJz_Jh_b4HNaj4i56X9wRGnz0l6i8/copy
={A2:E2;
sort({A3:E6;
query(A3:H6,"select A,B,F,G,H where A ='A1'",0)})
}
Imported columns with title Total can change their position, only the first column always remains in the same place:
The formula used:
=IMPORTXML("https://int.soccerway.com/matches/2021/02/06/england/premier-league/aston-villa-football-club/arsenal-fc/3344352/"&"head2head/",
"//div[#class='block_h2hsection_team real-content clearfix ']//table[#class='table compare section-dropdowns']//option[#selected='selected'] |
//div[#class='block clearfix block_h2h_general_statistics-wrapper body-table header-wrapper']//tr")
1 - I need to use only one function IMPORTXML because the spreadsheet is already at the limit so as not to collapse due to several imports.
2 - The Home and Away columns are of no use to me, so I would like to exclude them to take up less space.
3 - I tried to use the QUERY function to try to select, but I can only do this if the words Total were on the first row of the imported data and also if the first column was always the same word, but that doesn't happen either, the Premier League - 2020/2021 value happens in that specific game, but in other games they are other names.
try:
=TRANSPOSE(QUERY(TRANSPOSE(IMPORTXML(
"https://int.soccerway.com/matches/2021/02/06/england/premier-league/aston-villa-football-club/arsenal-fc/3344352/"&"head2head/",
"//div[#class='block_h2hsection_team real-content clearfix ']//table[#class='table compare section-dropdowns']//option[#selected='selected'] |
//div[#class='block clearfix block_h2h_general_statistics-wrapper body-table header-wrapper']//tr")),
"where not Col4 matches 'Away|Home'"))
I'm trying to SUMIF data based on two criteria:
The title of the column (horizontal)
In between two dates (vertical)
I have tried a number of functions to solve this problem but to no avail.
I have tried functions with Match, Index, and Filter, but I couldn't make the function work.
As you can see in my code, I have found a workaround, but it is not ideal as it does not use the table header to identify the data values I'm looking for (see example function below for Product A).
=SUMIFS(B:B,A:A,">="&A$2,A:A,"<="&A$5)
I'm hoping for a function that can dynamically grab the values I'm looking for, based on the table header and the dates.
Thank you for any help you may provide.
You can also use index/match to select just the relevant column of the range (where a zero in the row parameter indicates the entire column):
=sumifs(index($B2:$D,0,match(F1,$B1:$D1,0)),$A2:$A,">="&$A2,$A2:$A,"<="&$A5)
=ARRAYFORMULA({B1:D1; TRANSPOSE(MMULT(
TRANSPOSE(FILTER(B2:D, A2:A>=A3, A2:A<=A5)),
TRANSPOSE(SPLIT(REPT(10,
COUNTA(FILTER(B2:B, A2:A>=A3, A2:A<=A5))), 1))^0))})
My Data
Summary Required :
enter image description here
Formula : =SUMIFS(INDIRECT("C"& MATCH(B15,$B$2:$B$10,0)+1 & ":" & "G"& MATCH(B15,$B$2:$B$10,0)+1),$C$1:$G$1,">="&DATE(2022,2,1),$C$1:$G$1,"<="&DATE(2022,2,28))