What I mean;
Is the content associated with a leaf also associated with the branch nodes that leaf terminates?
e.g.
Associate an item with "c" and it appears in "a","b" and "c".
I'd like the item to only be associated with "c" not "a" and "b" as well.
Have I missed something or is this correct?
Well, if you don't want c to imply a and b, then c should be a sibling of a and b, not a child.
Related
I have a cell (Say B16) that has a dropdown list with three options, depending on which one is picked I would like Cell D16 to return a value depending, i.e. if you Pick A return 0, B returns 1 and C returns 2.
I have tried multiple IF, OR, LOOKUP but nothing is working.
Any help would be fantastic.
Make a hidden sheet called mapping with the following:
Now it's just =VLOOKUP(B16,mapping!A:B,2,0). The advantage of this over the nested IF solution is that it's trivial to add more options and easier to read / edit in my option.
also you can use column A of mapping to populate your dropdown list.
Personally I don't like nested IFs as they are hard to read. If you want the transformation to be to {0, 1, 2} then you could use
=CODE(B16)-CODE("A")
This is idiomatic in programming languages using ASCII encoding. You can generalise this if you use CHOOSE. If you want {a, b, c} then use
=CHOOSE(1 + CODE(E3) - CODE("A"), a, b, c)
where a, b, and c are the values that you want: {0, 1, 3} in your case.
How about:
=IF(B16="A",1,IF(B16="B",2,IF(B16="C",3,"")))
This is for a return of {1,2,3}, modify for any three values you would like.
I have data that look like this (going on for many more rows):
What I want to do is:
Match the relationship of C and G to the relationship of I and J.
For example, I:Q1652 matches up with J:Q1662; therefore, C:Q1652 should also match up with G:Q1662.
At the same time, A & B and E & F should maintain their relationships with C and G, respectively
For example, when C:Q1652 and G:Q1662 are being matched, they should carry with them their respective rows/values from columns A & B and E & F.
Please let me know if there's anything more I can clarify! Thanks!
Please see K1:N1 cells in the below graph.
K1: =INDEX(A:A,MATCH($I1,$C:$C,0))
L1: =INDEX(B:B,MATCH($I1,$C:$C,0))
M1: =INDEX(E:E,MATCH($J1,$G:$G,0))
N1: =INDEX(F:F,MATCH($J1,$G:$G,0))
So say I have a table x by y entries.
X is far too great, or changes often enough, that making X additional tables/lists/named ranges is absurd.
However, I need to make a drop-down list of some of y.
Specifically:
Name | A | B | C | ..
Yannis| 20 |Yellow| Green| ..
Mirrah| 400 |Purple|Yellow| ..
.
.
.
I need a drop-down select of Name to change the options in a different drop-down list, which is based off of B & C.
Normally you can do this with either a Filter or INDIRECT(). However, it is beyond unreasonable to create a unique table, or name define, for each entry in X.
It is possible to create a table with all the possible entries for B & C, if there was a way to filter a named define for a list based off of the first table (using vlookup(), most likely)
In layman's terms: I need list 1 to filter list 2 where list 1 is either enormous or subject to constant change.
Gah, so this:
=INDIRECT("'InfoDump'!" & ADDRESS(MATCH(C5,PkmList,0)+25,10))
put into the data validation list works, however it's only one entry, and I need 3.
simply adding commas and copies causes error messages.
The one entry that this supplies is correctly referenced (dynamically) from the table without any need for more tables/namedRanges.
C5 is where the first list is
PkmList is the NamedRange for the first column of the Table
+25 'cause the table starts at A25 (column title)
10 referencing the first of 3 columns I need in the second list.
Okay!
After some experimentation, this accomplishes what I was looking for:
=INDIRECT("'InfoDump'!" & (ADDRESS(MATCH(C5,PkmList,0)+25,10)) & ":" & ((ADDRESS(MATCH(C5,PkmList,0)+25,12))))
or, in some different terms:
=INDIRECT("'sheetName'!" & (ADDRESS(MATCH(DropDownOne,DropDownOneCriteria,0)+(AdjustRow),(AdjustColumn))) & ":" & ((ADDRESS(MATCH(DropDownOne,DropDownOneCriteria,0)+(AdjustRow),(AdjustColumn)))))
Data validation hates logic.
-
In the most basic sense:
Match(a,b,c) gets the location of 'a' in 'b' (c is the same as vlookup's exact match option)
Address(row,column) gets the "j26" address, you can (as I did) adjust from where you found the match. (in my case, 25 down 'casue the table actually started at A25, but the list started at '1'; then 10 - 12 across for the 3 options I needed to list)
indirect(txt) turns this into a list. more or less. use "'sheetName'!" for referencing a different sheet.
-
So in the end this gives you a "=A2:A4" in the Data validation bar, based on another list. Same as using the popular work around that is the fruit vegetable cabbage example, but this doesn't require you to make multiple named ranges. (Which means it works for a single large changing table).
I have a simple-seeming problem, but in practice it seems to be more involved. In python, for example, it seems like it would be much more straightforward. But I would really like to learn how to do this in Stata.
Say that I have a big dataset. I have several string variables, S1, S2, and S3. I get a subset of S1 based on some criteria. Let's say that this gets me (after sorting and only the data of interest are displayed):
S1
1 A
2 B
3 C
4 D
5 E
Based on different criteria, I get, for S2:
S2
1 B
2 B
3 C
4 F
For S3:
S3
1 B
2 Long string
What I am interested in doing is to get a list of all of the distinct values across S1, S2, and S3. One way I have thought about doing this is:
Save all desired values of S1 into a macro, M1. I didn't figure out how one is able to do this.
Save all desired values of S2 into a macro, M2.
Check if the values of M2 are in M1. Do not add the values of M2 to M1 that are already in M1, but do add the values of M2 to M1 that are not already there. It seems like this post is similar to how to do this step. (Why is there a : in front of list?)
Repeat step 3, except for S3/M3 instead of S2/M2.
This would produce the macro M1 with values:
A B C D E F Long String
Note that I do not need this to be in a macro. If it could be in a matrix or some other way, that would work as well. The important part is to get the information.
Several ways to do this.
Many assumptions made in this example (many things are not clear in your post):
clear
set more off
input ///
str15(s1 s2 s3)
a "b" "b"
b "b" "long string"
c "c" ""
d "f" ""
e "" ""
end
list
stack s*, into(news) clear
bysort news : keep if _n == 1
drop _stack
list
If you want to work your way through, using macros, then help macrolists and help levelsof can aid:
clear
set more off
input ///
str15(s1 s2 s3)
a "b" "b"
b "b" "long string"
c "c" ""
d "f" ""
e "" ""
end
list
local uvalues
foreach var of varlist _all {
levelsof `var', local(loc`var')
local uvalues : list uvalues | loc`var'
}
display `"`uvalues'"'
Saying more about how your variables are organized (e.g. one or several files), whether you care or not to destroy the original data set, the treatment of missings, etc. can probably get you an ad hoc answer.
Suppose I have a sig A in my module that is related to a sig B.
Imagine now that we have the several instances :
A$1 -> B$1 , A$2 -> B$2
and
A$1 -> B$2 , A$2 -> B$1
I would like to express that B$1 and B$2 are equivalent (under certain conditions) such that only this instance would be generated A$1 -> B , A$2 -> B.
One of the solution might be to use the keyword "one" while declaring the sig B, but it won't work in my case, because B have several fields, making B atoms not necessarily equivalent . In short 2 atoms are equivalent only if they have their fields of same values.
Ideally I would like to remove the numbering for B. but still be able to have several atoms B .
The Alloy Analyzer doesn't give you much control over how the subsequent instances are generated (or how to break symmetries), so you typically have to work around those issues at the model level.
For your example, maybe this is the right model
sig B{}
one sig BA extends B {}
sig A {
b: one BA
}
run { #A=2 }
First you say that the two instances you describe are equivalent, although at a superficial level they appear to have distinct values for A$1 and A$2. Then you say "2 atoms are equivalent only if ... their fields [have the] same values". If that's the definition of equivalence, then your two instances are not equivalent; if your two instances are equivalent, then your definition is not capturing what you want.
It sounds as if you mean (1) that B atoms are either (1a) always equivalent, or (1b) equivalent under certain circumstances, and (2) that A atoms are equivalent if their fields all have values which are either identical or equivalent. And as if you want to prohibit equivalent A atoms. If that's so, then your jobs are:
Define a predicate that is true for two B elements if and only if they are equivalent.
Define a predicate for two A elements that is true if and only if they are equivalent.
Define a predicate (or a fact) that specifies that no two A atoms in the instance are equivalent.
If your problem is just that the Analyzer is showing you instances of the model which are not interestingly distinct from each other, then see Aleksandar Milicevic's response.