I am having issues when trying to use a greater than and less than conditional formatting. I would like to be able to change the color of a cell (E62) to green if it is less than another cell (E64) and if that is false I want to change it (E62) to red if it is greater than the the other cell (E64).
Hopefully that was easy to understand.
Try making two rules:
LessThan =E64, BackgroundColor green, Range E62
GreaterThan =E64, BackgroundColor red, Range E62
Related
I'm trying to create a multi rule custom formula for conditional formatting purposes in Google Sheets.
Here is what I want to achieve -
If Deal Size is Small, the deal length cell should be highlighted a specific color based on the criteria -
0-35 Green
35-40 Yellow
40+ Red
If Deal Size is Large, the deal length cell should be highlighted a specific color based on the criteria -
0-45 Green
45-55 Yellow
55+ Red
Here is some sample data -
Date Deal Started
Date Deal Ended
Deal Length
Deal Size
1/13/2023
1/25/2023
12
Small
12/8/2022
1/17/2023
40
Large
11/8/2022
1/9/2023
62
Small
10/7/2022
1/31/2023
116
Large
12/12/2022
1/30/2023
49
Large
I've read some blogs online but haven’t found a solution for what I want to achieve.
0-35 for green and 35-40 for yellow. So what color if exactly 35?
Use 3 custom formulas for conditional formatting. Move = signs where needed. Range in example C2:C7
Green:
=OR(AND(D2="Small",C2>0,C2<35),AND(D2="Large",C2>0,C2<45))
Yellow:
=OR(AND(D2="Small",C2>=35,C2<40),AND(D2="Large",C2>=45,C2<55))
Red:
=OR(AND(D2="Small",C2>=40),AND(D2="Large",C2>=55))
Result:
or you can do it like this too:
green:
=((D2="Small")*(C2>0)*(C2<35))+((D2="Large")*(C2>0)*(C2<45))
yellow:
=((D2="Small")*(C2>=35)*(C2<40))+((D2="Large")*(C2>=45)*(C2<55))
red:
=((D2="Small")*(C2>=40))+((D2="Large")*(C2>=55))
Scenario:
Select a cell, and after pressing the left button from the mouse and moving (dragging) to another cell it changes all the traversing cell's borders.
Expected behavior:
We do not need the default borders of cells when dragging one cell to another cell. We need only the source cell border and the destination cell border. (we can do this by changing border property)
Question:
How can remove the source to destination full cells range borders?
For more clarification please see this image.
Updated Answer
If you are asking whether you can alter the selection border (e.g., the blue border the WorkbookView renders in your screenshot) to only surround the top-left and bottom-rightmost cells (e.g., C3 and E5 only in your example) instead of surrounding the entire range selection (e.g., all of C3:E5), no, the behavior of how this range selection border is rendered cannot be modified in this manner.
If you are asking, apart from the range selection border, if you yourself can apply a cell border (via IRange.Borders APIs) to just these top-left / bottom-right cells, then this is possible:
IRange rangeSelection = workbookView.RangeSelection;
if (rangeSelection.CellCount > 1)
{
// Get size of range selection
int numRows = rangeSelection.RowCount;
int numCols = rangeSelection.ColumnCount;
// Create a new IRange representing only the top-left and bottom-right cells
// of the range selection.
IRange cornerCells = rangeSelection[0, 0]
.Union(rangeSelection[numRows - 1, numCols - 1]);
// Add a border to these cells.
cornerCells.Borders.Weight = BorderWeight.Medium;
}
Original answer based off original question
SpreadsheetGear supports an IRange.Subtract(...) method that will remove the specified range from another range. Example:
IRange range = worksheet.Cells["A1:B2"].Subtract(worksheet.Cells["B2"]);
Console.WriteLine(range.Address);
// OUTPUT: $A$1:$B$1,$A$2
That answers your direct question, though your description and diagrams might indicate you are asking for something beyond this but I cannot tell for sure. If so, it would help if you can update your question to use a more concrete example, providing perhaps actual screenshots of the WorkbookView or "before" and desired "after" ranges for your use-case (e.g., A1:B2 is selected and I want to change this to "..."), any actions / features in Microsoft Excel itself that provide the behavior you are looking for (which my help in determining if the same is possible in SpreadsheetGear), etc.
I am attempting to use Color scale between two cells. The Right Cell is the maximum of the character's Hit points and the Left cell is their current Hit Points. I want it to scale between Red for less than 10%, Yellow if less than 65% and Green at 100%
But using the scale it shows as just Red to Yellow and then Pops in at full green value OR just stays red until it is 100% instead of scaling
I think you need a couple of (v. simple!) formulae:
Midpoint has been truncated and is actually:
=C$1*0.65
Change Minpoint from 0 to =C$1*0.1 if you prefer, but seems not necessary.
use Number instead of Percentile where:
min: =C$1*0.1
mid: =C$1*0.65
max: =C$1
I have a custom UITableViewCell design as
What I want to is that "points" label should come under the last digit in my Numbers label. Lets say I have 1990 value in my Numbers label the "points" labels should come uder the last digit "0" in this case.
How can I do this?
You can add a Horizontal Space between the points label and the number label with a negative value roughly equates the width of 1 character
For instance here:
Here in this example the horizontal space is -30 while the font size of the number label is 61pt. You can see that it is roughly one character width. (Of course you can apply more complicated math if you please to get the exact value you desire or accommodates your design principle)
And with making sure that the number label does not have an explicit width constrain it will automatically expand to fit its contents and therefore pushing the points label appropriately.
like this:
I have dynamic text in a label with plenty of room around it. Since there is room, it would be great if the text could wrap in addition to autoshrinking.
You can apply any of these 2 solutions
1.Set numberOfLines To 0 and make larger height of your label then text automatically wrap.
2.you can dynamically calculate height of label on the basis of length of string with function sizeWithFont.