LibreOffice Calc: how to highlight the maximum value of ranges of cells at once? - conditional-formatting

I would like to highlight the maximum value for each group of cells using conditional formatting, and applying it at once.
In order to explain myself better, the file is something like this:
(But the real content has more than 1500 of these).
For each range in each column, I want to highlight the maximum value. So, for the range A1:A11, the cells A2, A5, A7 and A10 should be with a different format. The same for the range A18:A28, where A26 and A28 should be different, and so on for B, and C, etc.
I have tried selecting A1:I28 and apply conditional format where cell is equals to max(a1:a11) apply a good format, but it doesn't work well. It think I don't how to use the references in the sheet in order to be considered in a right way.
Any ideas?

AFAIK you can't do this "at once", thus in a single step. To get this working with a spreadsheet layout as in your example, you'll have to define the conditional formatting for each "dataset" separately (it would be easier if the spreadsheet wouldn't contain two "rows" (1st: 1-11; 2nd: 18-28) on the same sheet). With dataset, i mean the distinctive ranges A1:A11, B1:B11, ... A18:A28, B18:B28 and so on.
To be more precise: you need to define the conditional formatting rule for the first dataset of its row (in your example: A1:A11 and A18:A28, respectively), then you can apply it to the other datasets using format pasting.
To do so:
define the conditional formatting for range A1:A11 with formula A1=MAX(A$1:A$11). Notice the dollar signs - without them LO will compare A2 to MAX(A2:A12), A3 to MAX(A3:A13) and so on. The dollar signs make sure that every cell in A1:A11 will be compared to exactly that range only.
Select A1:A11, copy it;
Select B1:B11 and paste just the formatting, using the "Paste Special" functionality (Menu Edit -> Paste Special... or SHIFT+CTRL+V, select Format only in the Paste Special dialogue).
Repeat step 3 for C1:C11, D1:D11 and so on till I1:I11;
Repeat step 1 and 2 for A:18:A28 (formula should be A18=MAX(A$18:A$28));
Repeat step 3 for B18:B28 and so on.
If you try to paste the formatting to more than one column, LO won't handle the target range as entity but will define the formatting for each cell, thus it will define a conditional format for B1 with formula B1=MAX(B$1:B$11), B2 with B2=MAX(B$2:B$12) and so on. It's vital to have only one conditional format definition for each separate range, thus for A1:A11, B1:B11 and so on. You can control how LO had handled your modifications by checking the resulting conditional format definitions in Menu Format -> Conditional Formatting -> Manage....

Related

Format One Cell with ColorScale Based on Range of Cell Values

I need to format a single cell with a gradient color based on the values of a range of cells. Similar to the conditional formatting with a ColorScale, except only applying the formatting to a single cell based on the values of a range of cells.
Most likely this will need to be done in VBA. I can't seem to find a simple way to do this without rewriting a similar script to the built-in ColorScale methods.
Example:
B10 formatted with a color in a scale based upon the values of B10:B40. ColorScale would be type 3 with Low, Mid (50%), and High. But I don't want to format any cells other than B10, just use the values of the range B10:B40
I will then do the same for B11:B41, but only formatting B11, then B12:B42, B13:B43, etc..
All I need is to figure out how to create a ColorScale based on a range of values but only apply the formatting to one of the cells.
Edit:
If someone knows a way to create a color scale script similar to the conditional formatting one built into Excel, that would also be a good fix. If I can just calculate the scale from the values in the range of cells and apply to the one cell with the color grade, that would be a solution.
I think what you are after is a 3-color scale for B10 to B40 (so that B10 acquires a colour based on that cell's ranking in the range) together with a separate rule that applies white formatting (in appearance, no formatting) to B11:B40. The latter rule should be at the top of the list of rules and Stop if True checked.

MS Excel dynamic print area

I wish to create a dynamic Print_Area in Excel 2010 which will consist of two cell ranges.
For example the first cell range is A1:J50 and the second range is A100:J150. These should print out on two pages, ignoring the cells that come in between these two ranges.
The four cells shown in the above example ranges should be dynamic, and not hard coded as simple Print_Area ranges. Therefore in my worksheet I used cells AA1, AB1, AC1 and AD1 to store values "A1", "J50", "A100" and "J150" respectively.
(The cells AA1, AB1, AC1 and AD1 actually use formulas to determine what cell address will be used, but for this question lets just assume the values are set as above).
I then used the Name Manager and entered the following formula under Print_Area:
=INDIRECT(Sheet1!$AA$1):INDIRECT(Sheet1!$AB$1);INDIRECT(Sheet1!$AC$1):INDIRECT(Sheet1!$AD$1)
The result of this formula is exactly what I need, and it actually works the first time I print the ranges. However once I did that, Excel automatically substitutes the formula with the actual cell range that was calculated. So when I check the Print_Area in the Name Manager after printing once, it contains something like:
=Sheet1!$A$1:$J$50,Sheet1!$A$100:$J$150
Is there a way to prevent the Print_Area from converting my formula to calculated values, and instead using the formula every time I print? I would like to not use macros if at all possible (if not, I'll try macros too)
I tested this and it seemed to work.
Create a new name called Test and set its value to (Note that I used a comma rather than the semicolon you had. I have US language set)
=INDIRECT(Sheet1!$AA$1):INDIRECT(Sheet1!$AA$2),INDIRECT(Sheet1!$AA$3):INDIRECT(Sheet1!$AA$4)
Set your Print_Area name to
=TEST
Good luck!
EDIT
The above works for me, but it appears unnecessary. I just tried to replicate the problem, and was unable. When I have the Print_Area set to the formula with INDIRECT it does not replace after printing.
See this linked file. https://www.dropbox.com/s/pgm0iv19u6igdm5/Book1.xlsx

Change #N/A to Blank cell

How can I change the #N/A to the blank cell if nothing in that cell?
Eg. =VLOOKUP(B19:B36;$TABLE.A1:C46;2;0)
I think I might need something like an ISERROR check but I don't 100% know what I'm doing.
If we're talking about Excel 2010 and later you can use IFERROR:
=IFERROR(VLOOKUP(B19:B36;$TABLE.A1:C46;2;0);"")
You can also put text into the final string result
The question was misleading about the spreadsheet software as 2 different spreadsheets were originally stated in tags. However, it can be seen that the question is about OpenOffice Calc:
- Absolute sheet referencing ($ sign before the sheet name) is not possible in Excel.
- We also see a dot between the sheet name and the range, which is again not possible in Excel.
As in OpenOffice Calc you don't have IFERROR function, the only way is to repeat your main function twice in the following form (you can use both, ISNA and ISERROR, but I suggest ISNA as it's more specific and fits your case):
=IF(ISNA(YourFormula);"";YourFormula)
In your case something like:
=IF(ISNA(VLOOKUP(B19;$TABLE.A1:C46;2;0));"";VLOOKUP(B19;$TABLE.A1:C46;2;0))
You may want to make absolute reference to the range where you look for matching values, as I see you want to copy the formula down.
=IF(ISNA(VLOOKUP(B19;$TABLE.$A$1:$C$46;2;0));"";VLOOKUP(B19;$TABLE.$A$1:$C$46;2;0))
Since the cells will contain a formula this is about appearances, so Conditional formatting might suit, say if the cell background is white, for style choose Font > Font Effects > Font color white.
For this, select the relevant range - I have assumed D19:D36 - and Format > Conditional Formatting... and for Condition 1 choose Cell value is and equal to and:
ISNA(D19)

google spreadsheet array length varies. I'm left with -- after shorter array calculations

In google spreadsheet, my array length varies. I'm left with -- or a double dash after a shorter input is calculated and placed into the array or if i clear the input entirely.
Ex.formula =iferror(if(E10="",transpose(split(upper(D1),",")),query(vlist)),"")
The above will either take input from E10 or D1. If i clear all the input im left with -- in some cells. If shorter input is calculted I'm also left with -- in previous longer array positions.
Is there any way I can eliminate the possibliity of -- appearing in
cells?
Maybe I the original question should be, How can a fixed array
ignore null values and not output -- or double dash.
I have been struggling with this, too. And now i found a workaround to it in this forum answer.
The workaround is not to suppress the -- directly, but to handle them in the cells that use this data. You can handle them with the ARRAYFORMULA(IFERROR( functions.
I realized that if you have several cells where you use this data, instead of changing all these cells, a more comfortable way to do this is to
create an (invisible?) "helper" array somewhere else in your sheet, where you put your formula that creates the --
apply the workaround in the cell where you originally had your formula.
Example:
Cell A1 contains =SORT(UNIQUE(Sheet2!X:X)) (which eventually results in -- in the cells A2, A3,... if the number of unique values in column X on sheet 2 decreases).
Workaround: Use your formula =SORT(UNIQUE(Sheet2!X:X)) e.g. in cell B1 and put =ARRAYFORMULA(IFERROR(B:B)) in A1.

Linking cells in excel with a specific format

I am trying to link cells in excel on two different work sheets.
I am using the formula eg: cell1 = cell2 + cell3. The numbers that I have in cell2 and cell3 are in format of 100% (1) and 50% (2). I just want to add numbers 1 and 2 so that my cell1 will have number 3.
Is it possible to do without changing the cell formats?
Thanks a lot.
If you don't care about the percentages, just copy your column with the percentages and change the format of that column to value and in sheet 2, do addition on that column instead.
Unfortunately when a cell has a format of percentage and a user enters a number, it is converted into what it means given the context of the format. It's not like what is being displayed is wildly different than what is 'hidden' inside the cell. When you reformat a cell, that data is reformatted as well, so 50% becomes .5 even if you had originally entered 50 in the cell before changing it's format. Format is more than just 'display format' so maybe that's where the confusion is.
If you want to add the cells in the percentage row and not bother with reformatting the formula cell you can cheat and treat it as a string to get rid of that %. You could do =Left(A2+A3, Len(A2+A3)) that will give you the 1.5 answer without having to format te cell.
Not sure i understood your question but i'll give some elements:
formula and formats are separated in Excel, thus, you can set a formula in A1, say =A2+A3 but displays the value the way you wish
for instance, if A2 contains 100% and A3 contains 50%, then the result in A1 is worth 1.5
you can set the format of A1 the way you wish (Right-clic > Format cells > Number tab), for instance, decimal, the cell will then display 1.5 but if you choose percentage, the cell will then display 150%
Please elaborate your question if needed.
[EDIT] New answer thanks to your comment:
If i understand well, you want to sum up the values between brackets in your cell (whatever is before, event percentages in your case).
Then, you can try this in cell A3:
=MID(A1,FIND("(",A1)+1,FIND(")",A1)-FIND("(",A1)-1 )+MID(A2,FIND("(",A2)+1,FIND(")",A2)-FIND("(",A2)-1 )