Values to check with
| | Northing | Easting |
|-------|----------|---------|
| Inst1 | 41345 | 33467.8 |
| inst2 | 41600.5 | 33607.2 |
| Inst3 | 41900.8 | 33740.2 |
| Inst4 | 41933.4 | 33780 |
| Inst5 | 41829.5 | 33694.6 |
| Inst6 | 41449.9 | 33539 |
Range of Coordinate
| | Northing | | Easting | |
|----|----------|----------|---------|----------|
| T1 | 41158.68 | 41396.88 | 33357.6 | 33517.57 |
| T2 | 41307.9 | 41456.6 | 33384.2 | 33580.5 |
| T3 | 41372.1 | 41517.5 | 33411.3 | 33607.5 |
| T4 | 41431.6 | 41572.7 | 33435.8 | 33632.5 |
| T5 | 41482.9 | 41654.6 | 33472.3 | 33654.2 |
| S1 | 41564.9 | 41701.2 | 33493.1 | 33688.7 |
| S2 | 41611.5 | 41762.3 | 33520.2 | 33708.3 |
| S3 | 41672.7 | 41841.6 | 33555.5 | 33734.1 |
| S4 | 41752.2 | 41897.9 | 33580.6 | 33767.6 |
| S5 | 41809.3 | 41941.7 | 33600.1 | 33791.7 |
| S6 | 41854.6 | 41998.7 | 33625.4 | 33810.7 |
| T6 | 41914.8 | 42055.4 | 33650.7 | 33836.1 |
| T7 | 41971.5 | 42137.4 | 33687.2 | 33859.9 |
Nested IF is not displaying the right value and can't go beyond row 48.
How can I have range M41:Q53 included?
Current formula in place below
=IF(N41<=$H$41<=O41 & P41<=$I$41<=Q41,M41,IF(N42<=$H$41<=O42 &
P42<=$I$41<=Q42,M42,IF(N43<=$H$41<=O43 &
P43<=$I$41<=Q43,M43,IF(N44<=$H$41<=O44 &
P44<=$I$41<=Q44,M44,IF(N45<=$H$41<=O45 &
P45<=$I$41<=Q45,M45,IF(N46<=$H$41<=O46 &
P46<=$I$41<=Q46,M46,IF(N47<=$H$41<=O47 &
P47<=$I$41<=Q47,M47,IF(N48<=$H$41<=O48 & P48<=$I$41<=Q48,M48,"Not
here"))))))))
When comparing coordinates, the choice of coordinate system doesn't change the logic very much. :-)
It can be tricky (but not impossible) to consistently check if a point is within a polygon, but just a plain ol' rectangle like this is straightforward. If you intend to compare more than a few coordinates then nested If's just won't work. (In fact they should be avoided at all times!)
For my quick-n-dirty example I took your data and put it into Columns vs Rows instead of side by side.
The formula is H6 is:
=IF(AND(H$3>=MIN($C6:$D6),H$3<=MAX($C6:$D6),H$4>=MIN($E6:$F6),H$4<=MAX($E6:$F6)),"Match","-")
Basically it's just checking:
Is Northing To Match greater than or equal to `MIN of NorthingStart & NorthingEnd?
Is Northing To Match less than or equal to `MAX of NorthingStart & NorthingEnd?
If Yes to both then the point Northing to Match is within the specified rectangle.
There are a number of other ways this could also be tackled. Which one is the right one depends mainly on how much data you'll be comparing, and whether it's an ongoing need (needing to account for unforeseen circumstances or not)...
The same thing could also be accomplished with side-by-side datasets with the help of an array formula.
Further Reading:
Introduction to Coordinate Geometry (many handy links)
SE: Analytic Geometry: How to check if a point is inside a rectangle?
Wikipedia: Intersection_theory
How to check if two given line segments intersect?
And a but of a tangent (no pun intended), but since I mentioned it & just for fun, a short explanation of:
How to check if a given point lies inside or outside a polygon?
1. Draw a horizontal line to the right of each point and extend it to infinity
2. Count the number of times the line intersects with polygon edges.
3. A point is inside the polygon if either count of intersections is odd or
point lies on an edge of polygon. If none of the conditions is true, then
point lies outside.
How to handle point g in the above figure?
Note that we should returns true if the point lies on the line or same
as one of the vertices of the given polygon. To handle this, after
checking if the line from p to extreme intersects, we check whether
p is colinear with vertices of current line of polygon. If it is
colinear, then we check if the point p lies on current side of
polygon, if it lies, we return true, else false. (Source)
Related
Consider the following data below:
| 1st | 2nd | A | B | C | D | E | F | G | H |
|-----|-----|---|---|---|---|---|---|---|---|
| y | x | | | 1 | | | | | |
| y | x | | | 1 | | | | | |
| y | x | | | | 1 | | | | |
| | x | 1 | | | | | | | |
| y | | 1 | 1 | 1 | | | | | |
| y | x | | | | | | 1 | | |
| y | | | | | | | | 1 | |
| | x | | | | | 1 | | | |
| | x | | | | | | | | 1 |
| y | x | | | | | | | | 1 |
What I wish to do is to return all column headers (from A to H) that meets the following condition: it should have a value of 1 that is both aligned with a y and x value from the first two columns.
I already have a working array formula to do this, which is as follows:
{=INDEX($C$1:$J$1,SMALL(IF(($A$2:$A$11="y")*($B$2:$B$11="x")*($C$2:$J$11=1),COLUMN($C$1:$J$1)-COLUMN($B$1)),ROW(1:1)))}
However, while I drag this down, it returns two C values and one for D, F and H.
This is since there are two 1's under header C that meets the said condition. What I want is to return unique values, so C should only be returned once. I tried to make use of MATCH and additional COUNTIF instead of the SMALL function, but it is returning an error, and the 'Evaluate formula' feature of Excel isn't helping. Below if the erroneous formula I experimented with:
{=INDEX($C$1:$J$1,MATCH(0,IF(($A$2:$A$11="y")*($B$2:$B$11="x")*($C$2:$J$11=1),COUNTIF($N$1:N1,COLUMN($C$1:$J$1)-COLUMN($B$1))),0))}
A workaround I am currently doing is to make my first formula a "helper column" and then create another formula based from the first formula's result to return only the unique values. However, the double array formula is heavily affecting the efficiency of Excel's calculation due to the huge volume of data I'm dealing with.
Any help/suggestions will do please (no VBA please, since I believe it's not needed here). Thanks!
Insert a helper row. I did it just under your header row before your data. In this row you check to see if there is a 1 that lines up with an x and a y. I assumed this to be non blank, but if its specific values change the formula from <>"" to ="y" or =134 as the case may be. Place the following formula under your first column header you are interested in and copy right.
=--(0<SUMPRODUCT(($B$3:$B$12<>"")*($C$3:$C$12<>"")*(D3:D12=1)))
Then where you want to generate your list in a column without space and sorted in the order the appear in from left to right in the headings, use the following formula and copy down as required:
=IFERROR(INDEX($1:$1,AGGREGATE(15,6,COLUMN($D$2:$K$2)/$D$2:$K$2,ROW(A1))),"")
The above formula put in a blank value when no column heading applies are you have copied the formula down beyond the number of applicable columns.
The above formulas are based on the proof of concept image below. Adjust ranges to suit your needs.
Have you tried without the use of an array formula? I don't know how large the data actually is. But, this might be what you are looking for:
=IF(COUNTIFS($A:$A,"y",$B:$B,"x",C:C,1)>0,C1,"")
Assuming column A is "1st" and "H" is your last column at colunm J. Try pasting the formula at "K1" and drag it to your right until "S1".
I have a spotfire question. Is it possible to divide two "calculated value" columns in a "graphical table".
I have a Count([Type]) calculated value. I then limit the data within the second calculated value to arrive at a different number of Count[Type].
I would like to divide the two in a third calculated value column.
ie.
Calculated value column 1:
Count([Type]) = 100 (NOT LIMITED)
Calculated value column 2:
Count([Type]) = 50 (Limited to [Type]="Good")
Now I would like to say 50/100 = 0.5 in the third calculated value column.
If it is possible to do this all within one calculated column value that is even better. Graphical Tables do not let you have if statements in the custom expression, the only way is to limit data. So I am struggling, any help is appreciated.
Graphical tables do allow IF() in custom expressions. In order to accomplish this you are going to have to move your logic away from the Limit Data Using Expressions and into your expression directly. Here should be your three Axes expressions:
Count([Type])
Count(If([Type]="Good",[Type]))
Count(If([Type]="Good",[Type])) / Count([Type])
Data Set
+----+------+
| ID | Type |
+----+------+
| 1 | Good |
| 1 | Good |
| 1 | Good |
| 1 | Good |
| 1 | Good |
| 1 | Bad |
| 1 | Bad |
| 1 | Bad |
| 1 | Bad |
| 2 | Good |
| 2 | Good |
| 2 | Good |
| 2 | Good |
| 2 | Bad |
| 2 | Bad |
| 2 | Bad |
| 2 | Bad |
+----+------+
Results
I have been using the Notion Window Manager (http://notion.sourceforge.net/) for a few weeks. I was wondering if it is possible to create a keybinding that splits a workspace in the same way that META+S and META+K S splits a frame horizontally and vertically.
So if I had two vertical frames in a workspace like this:
-----
|1|2|
| | |
| | |
| | |
-----
The keybinding to split horizontally should add a new frame that spans the workspace horizontally:
-----
|1|2|
| | |
-----
| 3 |
-----
Currently META+S only splits the selected frame horizontally:
-----
|1|2|
| | |
|-| |
|3| |
-----
Is there any way to accomplish splitting the entire workspace horizontally or vertically in Notion?
The solution I came up with is to add a keybinding to the split_top function in cfg_tiling.lua. To split horizontally I added:
kpress(META.."Z", "WTiling.split_top(_, 'bottom')")
to the WTiling defbindings function. I also added
kpress("Z", "Wtiling.split_top(_, 'left')")
to the submap META.."K" bindings.
The split_top function splits at the root of the split tree. This will create a new frame that splits the entire workspace rather than the current frame.
One sizing issue that I noticed with this approach is that it will try to split the workspace exactly in half. If there is a horizontal frame splitting a workspace split_top will resize it to the smallest size and add a new frame below it. If there is a vertical frame it will become about 10 pixels wide when the new frame is added.
Horizontal size issue. New frames are 0 height:
Start ->Mod1+Z ->Mod1+Z
-1--2-- -1--2-- -1--2--
| | | | | | | | |
| | | | | | | | |
-3----- -3----- -3-----
| | -4----- -4-----
| | | | -5-----
| | | | | |
| | | | | |
------- ------- -------
Vertical size issue. New frames are 0 width:
Start -> Mod1+K Z -> Mod1+K Z
-1----2---- -4--1-2---- -5-41-2----
| | | | || | | ||| |
| | | | || | | ||| |
| |3---| | ||3---| | |||3---|
| | | | || | | ||| |
| | | | || | | ||| |
----------- ----------- -----------
Another issue is the focus does not change to the newly create frame. Hitting Mod1+Z will create the frame but the user has to Mod1+TAB to the frame to manipulate it.
This is a start but a comprehensive solution would check for frames that already split the workspace and split them instead and change the focus to the new frame.
Yes, you can.
You either need to put your binding in the workspace context or from the frame/mplex context you need to look up the managing workspace and then call split on that.
(I'd post code and more concrete terms but I'm not in front of a notion machine at the moment and don't want to confuse things by using the wrong ones.)
I usually have my Vim screen split into two vertical windows, each of which may be further horizontally split. Sometimes, I want to add or delete a vertical window. Is there a way to detect how many top-level vertical splits there are and add or remove vsplits as necessary?
For example, suppose my screen looks like this:
+--------+--------+
| | |
| | |
+--------+ |
| | |
| | |
| +--------+
| | |
+--------+--------+
I want :Columns 1 to give me
+--------+
| |
| |
+--------+
| |
| |
| |
| |
+--------+
by closing the two right-most windows.
I want :Columns 2 to do nothing, detecting that two columns are already open.
And I want :Columns 3 to give me
+--------+--------+--------+
| | | |
| | | |
+--------+ | |
| | | |
| | | |
| +--------+ |
| | | |
+--------+--------+--------+
I am fine if the function ignores vertical splits within horizontal splits. For example, if I had
+--------+
| |
| |
+---+----+
| | |
| | |
| | |
| | |
+---+----+
and I ran :Columns 2, I would get
+--------+--------+
| | |
| | |
+---+----+ |
| | | |
| | | |
| | | |
| | | |
+---+----+--------+
There is indeed a way, but it is involved; the first step is to count the currently-open vertical windows, and I don’t know of any built-in function that facilitates this. The working approach I found to it is basically to start at the first window (the top of the first — if not the entirety of the first — vertical split), and to then, using wincmd l, move to the next window to the right for as long as wincmd l moves to a new window, adding each to a count of open vertical windows including the first one. (I think this is what Gary Fixler referred to in the comments on the question.)
I started trying to write the code for posting here, and it grew to become larger than any function I would want to put in my ~/.vimrc, so I ended up turning it into a plugin which takes the above approach and provides the :Columns command; see Columcille (on vim.org at http://www.vim.org/scripts/script.php?script_id=4742.) The plugin also provides a command for similarly managing horizontal split windows: :Rows divides the current column (or the main window, if there are no open vertical splits) into the specified number of “rows.”
I am trying to position an inner element inside the root element. The root element is set to be 100% high and 100% wide. However, I want the inner svg to be 10px or so from the edge of the outer svg--all except the right edge, which I would like to be 200px from the outer right edge. I want this to display in a web browser and so the user should be able to resize the browser and hence the outer svg while the inner svg should be able to maintain the correct distance from the outer svg on each side.
Like this:
+OUTER SVG------------------------------------------+
| |
| +INNER SVG----------------+ |
| | | |
| | | 200px |
| | | <---+-----+----> |
| | | |
| | | | 1
| | | | 0
| | | | 0
| | | | %
| | | |
| | | | h
| | | | i
| +-------------------------+ | g
| | h
| |
+---------------------------------------------------+
100% Wide
Is it possible to do this with SVG alone?
If I understand you correctly, this is trivial. SVG is built to have many visual elements in a Z stack, aligned, overlapped, whatever.
Use Inkscape, free and opensource, to create SVGs, and then you can edit the file directly in a text editor if you want to see how SVG is formed. In Inkscape you can use the alignment tools, the grid, the transform-scaling tool, drag and drop, and probably some other tools to accomplish this.