How to highlight max or min data? - tabulator

If I have an NxM grid of tabulator data that's numerical, I want to bold or highlight the cell that's maxmimum in a row or maximum in a column. I was wondering the best way to do this. It seems like I should pass in the row into a custom formatter, then iterate over the entries to get the max and return the format as bold or whatever.
This just seems a little calculation heavy as I have to iterate over all the cells for each row. Anyone have a better idea? Is there a built in way to get this? I couldn't find it in the documentation.

The most efficient way to handle this would be to identify the max/min values before importing them into the table by simply iterating over the array.
You could then set some flag properties in the row data(eg minRow, maxRow) that are set true if they apply, and then in the rowFormatter function use these to apply appropriate styling

Related

How do you average repeating blocks of cells in Excel?

I am trying to figure out how to average 4 x 4 groups of cells in my spreadsheet across a very large data set. I've tried using OFFSET with a cell range (e.g. B2:E5) but I haven't had success (I don't even know if you can use a range for the reference with OFFSET). This is my first time tackling a problem like this, so any advice would be welcome! A portion of the data set is attached to give an idea of the ranges I would like to average.
If the data was in B2:Q17 you could use this complicated looking formula to return the average for each 4*4 block.
=AVERAGE(INDEX($B$2:$Q$17,(ROWS($2:2)-1)*4+1,(COLUMNS($R:R)-1)*4+1):INDEX($B$2:$Q$17,(ROWS($2:2)-1)*4+4,(COLUMNS($R:R)-1)*4+4))
You would copy this across and down and it could go anywhere on a sheet.
You can use INDEX to refer to a range derived from values fro TopLeft and BottomRight corners, in the form
INDEX(DataRange, TopRow, LeftCol):INDEX(DataRange, BottomRow, RightCol)
Then wrap that in AVERAGE(...)
To demonstrate
=AVERAGE(INDEX($B$7:$AH$903,B1,B2):INDEX($B$7:$AH$903,B3+B1-1,B4+B2-1))
Note: INDEX has the advantage over OFFSET in that it's non-volatle

dynamically generate formula in excel

Lets say I have two sets of data and want to compare each row and column to make sure that they are identical.
Both sets of data have the same number of Columns and rows, say first set is Columns A-G, 2nd set of data is on the same tab an goes from H-N (in reality I actually have 50+ columns in each set).
Typically what I do when I don't have a lot of columns, i do something like:
=if(AND(A2 = h2, B2=i2, c2=j2),"Good","Bad")
Once I have a formula, then I press the little square and drag it down across all rows. This is able to quickly show me whether there is data difference in any of the columns or not.
However in this case I have a lot of columns to compare. Is there a quicker way to do this, or generate dynamically somehow?
Thanks.
You could use SUMPRODUCT:
=IF(SUMPRODUCT(--(A2:G2=H2:N2))=0,"Good","Bad")
=TEXTJOIN(,,A1:C1)=TEXTJOIN(,,h1:j1)
This will return either TRUE or FALSE.

Variables avaible in macros

What are the types of identifying a cell as far i know it is
Sheet#.Cells(var,position) or Range(A1) are there any other types of identifying a cell.
Also I know how to increment Sheet#.Cells(var,position) but how do i increment Range(A1) in macros using while loop and any other mode?
I am trying to pick values based on condition from master sheet and populate output sheet row by row.
When I use Sheet#.Cells(var,position) it messes with the position when I get inconsistent data.
I'm not sure if I get right what you need. However...
In Excel you can use something like this:
Range("E10").Offset(row_move, column_move)
where row_move allows to offset in both top/bottom direction, column_move offset to left/right direction. To move top/left direction you need to use values <0.
There is other option which I personally don't like:
Range("A" & row)
but as you can see it's easy to change row position in that situation and more difficult to change column.

Excel, Specifying cell contents as a result of other cells

I don't use excel often, and I haven't really found a good solution to my problem. (which is probably really simple).
I would like to have a cell with a function in my spreadsheet that shows another cell value value that depends on yet another cell value.
Such as:
The Best Deal heading simply uses the formula
=MAX(D3,D1000)
But under Best Deal I would like to display the Name Test1 rather than the numeric value.
Another thing that would be nice to know, is if there is a way to know the maximum row with data in it. So rather than =MAX(D3,D1000) something like =MAX(D3,Max(RowCount_InD))
Obviously that function wouldn't work as I wrote it, but hopefully this pseudo code gives you an idea of what I mean. The purpose is that if more entries are added, it would be able to handle them.
I know this is possible, but I'm having some trouble. Hopefully I can get some help here.
Thanks!
The easiest way to do this is to use a combination of Index and Match. Match will find the position of the maximum value, and then Index will look in column A and return the data in that same position. So, your formula would be:
=INDEX(A$3:A$1000,MATCH(MAX(D$3:D$1000),D$3:D$1000,0))
Put that formula in F3. No hidden columns required.
Sorry, I missed the part about the expanding range. You can do that by using Count or CountA along with Offset. The new formula would be:
=INDEX(A3:OFFSET(A3,COUNTA(A:A)-1,0),MATCH(MAX(D3:OFFSET(D3,COUNT(D:D)-1,0)),D3:OFFSET(D3,COUNT(D:D)-1,0),0))
More complex, but it is basically the same except that it will expand as you add new values at the end.
There is only one 'simple' way I can think of this, but it requires hidden columns (sorry).
set E1 = A1 and fill down all the way (Basically you are making a copy of column A in column E but you are using a formula so it will always be the same)
Then under 'Best deal' - put this formula:
=VLOOKUP(MAX(D3,D1000),$D:$E,2,FALSE)
Then hide column E so it doesn't look like a mess. This way you do not need any fancy macro's and it will work everywhere because it is a normal formula.
"Another thing that would be nice to know, is if there is a way to know the maximum row with data in it. So rather than =MAX(D3,D1000) something like =MAX(D3,Max(RowCount_InD))"
This is a called a dynamic named range. Create a name for the ratio data, and set up the formula for the name range to be this:
=OFFSET($D$3, 0, 0, COUNTA($D$3:$D$1048576), 1)
More info here: http://www.ozgrid.com/Excel/DynamicRanges.htm
Then, assuming you name this named range ratio_data, your function could be referring to =MAX(ratio_data) in combination with index-match as suggested by #Tim Mayes. The range will expand automatically as you add more data.
=INDEX(A$3:A$1000,MATCH(MAX(ratio_data),ratio_data,0))
Ideally, you can replace the A3:A1000 by a dynamic named range as well.

How can I make Excel's MIN function ignore zeroes in a set?

In Excel, I have the following formula =(MIN(H69,H52,H35,H18)*(1/H18))*10 that is supposed to return the MIN of a range, and divide it by the current cell (*(1/H18) ), then multiply by 10.
I am having difficulty with adding a type of NULLIF statement. I want to be able to have (the possibility for) blank rows, and have the MIN function ignore zero/blank fields while selecting the next lowest value (all are between 1.0-0.1).
Is there a modifier i can apply to the MIN function to make it not compare zeroes in the MIN set? Is there a better function than MIN to use?
Here is the arrangement:
Please remember to include the syntax for where the MIN's set goes
The reason for the H69,H52,H35,H18 using commas is that these are embedded, individual cells that are arranged for visual presentation as well. Using a range, or colon/semi-colon operators don't appear to work for this purpose (see pic).
This is to prevent the following situation: users will need to eliminate fields that are zeros from the form, theres 2 formula edits per entry, averaging 4 entries per use, so 8 possible errors per form use...
You can use an array formula:
=MIN(IF(A1:A100>0,A1:A100))
You will need to hit ctrl+shift+enter to activate this formula.
You could use
=SMALL(A1:A3,COUNTIF(A1:A3,0)+1)

Resources