In LibreCalc I am trying to set a field to a color depending on what number is entered in the field. The column C needs to be the color red if it is 25% or less of Column B.
Column C also needs to be the color green when it is above 75% and the color orange when it is between 25% and 75%.
Under Format, choose Conditional Formatting --> Condition. You will see a dialog box where you can impose the Condition with the setting Formula is as follows; enter the formula:
(C1 / B1) <= .25
Then, add a new style with the desired background color, red. Say ok and then add another condition, this time with the second contingency:
(C1 / B1) > .25 and (C1 / B1) <= .75
Repeat adding style, this time do the background for the style orange. Then add a third condition for green, with the right formula and another style.
After you are done, copy the contents of the cell to each other cell desired to be formatted in this way. You will be able to review all of the conditional formatting from the Manage option of the conditional formatting menu. Calc automatically alters the cell formulas to shift the cell references to the same extent as copying.
For reference, see LO page about conditional formatting.
Related
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....
I need a formula in EXCEL that place a number 1 in the cell next to the cell where the cell background is RED. See example below.
Is this possible at all without VBA?
This can be done from Name Manager this can be accessed by pressing Ctrl+F3.
You will want to create a named reference (i called this "color") and have it refer to =GET.CELL(63,OFFSET(INDIRECT("RC",FALSE),0,-1)) in the formula bar.
Now you can use this 1 cell to the right to determine the color index number of a cell:
So as red is color index 3 in the cell next to it you can apply the formula:
=IF(color=3,1,0)
Open the VBA editor and add a new module. Do this by going to the Developer tab and clicking Visual Basic. If you don't have the developer tab on the ribbon you will need to add it (do a quick Google search). Once the VBA editor is open, right click on the VBA project which has your workbook name on the left and insert a module.
Place the following code into the new module:
Function IsRed(rng As Range) As Integer
IsRed = (rng.Interior.Color = vbRed) * -1
End Function
then you can use the formula =IsRed(A1) to determine if A1 has a red background
note: this uses the default red in the standard colours
You can achieve it manually without VBA using an autofilter:
Make sure you have a title above the column with colours and above the column where you want the value 1 placed
Add an Autofilter (Select both columns, click the Filter button on the Data tab of the ribbon)
Click the drop down filter on the column with colours, then click on Filter by Colour, the choose the Red colour
In your second column, enter a 1 in every visible cell. (Enter 1 in the first cell, then fill down. Or, select all cells, type 1 then press ctrl-enter)
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.
I would like to use VBA to modify the color in a graph/chart in Excel based on values in 3 cells (correlated to RGB).
For example, cells A1 (Red), A2 (Green), and A3 (Blue) would each have a value that would correspond to a certain color. Based upon those values, the bar graph color would change to whatever the RGB color indicated. 115-20-110 would give me a pink bar color.
I currently have
ActiveChart.SeriesCollection.Interior.Color = RGB(A1, A2, A3)
But I don't really know VBA and it isn't working. Any help is appreciated, and if there is a less obtuse way I would be interested of course.
Thank you
Try:
ActiveChart.SeriesCollection(1).Interior.Color = RGB(Range("A1").Value, _
Range("A2").Value, _
Range("A3").Value)
SeriesCollection represents all of the series on the chart - you need to pick one to color...
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 )