I have a router with two different outputs into Expression Transformation for SETCOUNTVARIABLE($$COUNT1) and SETCOUNTVARIABLE($$COUNT2). I need a way compare $$COUNT1 and $$COUNT2. If they are not equal than move on to another task, if they are equal than do another. Is this possible? If so can someone point me in the right direction?
Related
I fully realize that this should be incredibly simple but I am actually struggling to resolve. Please see the following example. Using the example formula, the formula continues to work properly if any one of the numerical values in range B2:G6 are deleted and left blank. However, as soon as text is inserted into ANY cells of the B2:G6 , the formula fails and returns error. How do I revise the formula to continue to provide me the sum of the valid intersections that remain numerical when some of the criteria range (whether a good intersection point or not, is text)?
I am creating three coefficient plots with the same variables and want them to be one next to each other, but the third one does not fit horizontally so it appears under the other two. My code is
coefplot reg1O reg2O, bylabel(Overall) || reg1R reg2R, bylabel(Right) || reg1L reg2L, bylabel(Left) ||, keep(xvar1 xvar2 xvar3) xline(0, lpattern(dash)) nokey ciopts(lcolor(blue) recast(rcap)) color(blue)
I was wondering if there is a way to tell Stata to expand the eps figure horizontally so that all plots fit next to each other, regardless of how much space it takes?
Thank you very much!
The problem is probably not because of lack of space, but rather because you don't specify the option byopts(compact rows(1)). If you want all pots on one row or one column, you need to specify that. It's hard to tell without a reproducible example, though.
You probably know this webpage, but it's also explained here, in the section "How subgraphs are combined": http://repec.sowi.unibe.ch/stata/coefplot/getting-started.html
My issue is that I need to reference a cell (A1) which will either be the name of a state that can be found in column L, or it can be "All States" which I then want to include all results of column L. I can't work out how to include this.
=SUMPRODUCT(--(IF(A1="All States",Data!$L:$L,Data!$L:$L=A1)),Data!Q:Q)
I want to add a bunch more criteria based on the above so I don’t want to go down the route of imbedding the sumproduct in an if function because the formula will quickly become too unweildy.
You have a lot of choices. Using your initial formula I would tweak it to
(A) =SUMPRODUCT((IF($A$1="All States",1,($L$2:$L$11=$A$1)))*($Q$2:$Q$11))
But this would need to be entered as an array formula so instead of just confirming with ENTER, you need CONTROL+SHIFT+ENTER. You will know you have done it right when { } show up around your formula. Note that they cannot be added manually.
A non array type formula which would be faster I believe would be to look at your two options. You are either dealing with a single state or all states. Set up an IF check to determine if you need to sum all of column Q, or if you need to find a single value from column Q. I used the following formula:
(B) =IF(A1="all states",SUM($Q$2:$Q$11),INDEX($Q$2:$Q$11,MATCH($A$1,$L$2:$L$11,0)))
A bit of a cheat but but simplifies things, is to add a final state to the bottom of your list in L and call is "All States". In the corresponding row in Q place =sum(First Cell:Last Cell). If you do that then you can use the following formula:
(C) =SUMPRODUCT(($L$2:$L$12=$A$1)*($Q$2:$Q$12))
That are other options out there as well, just thought I would show some options.
I was wondering if anyone could help with the following. I have found one question and answer relating to my query (I think!!) but I can't break it down to do what I want.
I have created a spreadsheet and used the IF & AND functions to do half of what I want.
Basically if the answer is "no" in one column and one of four options in another (111,112,118,119) I want it to bring in the value of C2. This is what I have come up with:
=IF(AND(E2= "No",F2=112),C2,0)
This part works fine but I also need it to bring in the value of C2 if "Yes" (E2) is selected AND the value of D2 is equal to F2 - this is what I have come up with
=IF(AND(E2="No",F2=111),C2,0),IF(E2 ="Yes",D2=F2,C2)
It doesn't work.
I found the answer linked at the top of the post, but my Excel skills aren't up to pulling it apart to fit what I want.
The reason you can't get the formula to work is because there are two separate formula thrown together in a cell:
=IF(AND(E2="No",F2=111),C2,0) - alone this is a complete formula and will return either C2 or 0.
If you want to nest your if statements you need to look at chaining them off each other: If([something],[do this],If([something else],[do this],If(... you get the point.
In terms of what you are trying to achieve there is a more effective method though, by using another formula, MATCH() that returns the position of a match in the list (array or range) you provide. You can just check whether the result of that formula is a number, like so:
=IF(AND(E2="No",ISNUMBER(MATCH(F2,{111,112,118,119}))),C2,0)
EDIT
So instead of providing 0 when the result of the AND() is false, we kick off another if that is your "Yes" clause... This then gives the 0 if it fails... Flip them round if you want "Yes" to be calculated first.
=IF(AND(E2="No",OR(F2=111,F2=112,F2=118,F2=119)),C2,IF(E2="Yes",D2=F2,0))
So the final result based off your comment would have been:
=IF(OR(AND(E2="Yes",D2=F2),AND(E2="No",OR(F2=111,F2=112,F2=118,F2=119))),C2,0)
The answers in topics with similar titles haven't given me much of a resolution to my particular problem, but possibly I am not asking the right question. It might help knowing I'm an absolute noob when it comes to spreadsheets, so finding my way around is next to nil.
Currently I can set a basic function in the first cell A1 =ROW()
Simple right? Well now here comes the complication. If I click on the bottom right of the cell and start dragging I can then apply that very same function to a whole range of cells. Let's say I apply it from A1:A10. Every cell within this group now has the same function.
Hooray! We did it, right? I applied a function to a range of cells each with their own output. But wait, if I then go back to the original cell and change its formula none of the other cells change with it. GRRRRR!!!!
There are a couple of fixes I've come up with but don't necessarily know how to implement. The first is to have every cell link back to the original cell and reference its function. This would be useful if I wanted to randomly scatter dependent cells about the document. The other would be much more useful in an orderly group where you know the exact dimensions by specifying in the original cell the size of the array you want to apply the function to.
With that said, let me hear your thoughts.
The closest I've come to an answer is to use FORMULA() which returns the formula used by a cell as text. Unfortunately all answers on evaluating the text resort to scripting. How strange! I thought something like this would be common. Might as well get to scripting.
Hold on, I may have spoke too soon. An array can be made with =MUNIT(), but it's only square. Drats!
Ok... I'm hoping the zebra stripes will eventually become its own answer unless someone else beats me to it. So a simple array can be made with ={1,2;3,4} where commas separate values by column and semicolons for values by row except to generate it you have to press Control+Shift+Enter (because reasons?). I'm thinking now that I'll need to have functions that can generate lists of values based on a single function for each row, and pray that it'll work. So, back to looking. (Wow this is taking forever)
The way I was hypothesizing can't even generate a 1x1, e.g., ={ROW()} returns Err:512 which is a formula overflow.
Alright, in summary so far I've narrowed down the two options,
1) link every cell to the original formula
2) populate an array with a single formula
each with their own incomplete answer,
a) use FORMULA() to return the formula of a cell as text
b) create a hypothetical array like so ={LIST_OF_VALUES()}
These both require a strange form of the nonexistent EVALUATE() function to 'function' correctly. Isn't that fun?
Google Sheets handles case b by allowing ={ROW()}Control+Shift+Enter to generate =ArrayFormula({ROW()}). Working with the general case of any sized array being filled with a single function doesn't exist in the world of spreadsheets it seems. That's very saddening because I can't think of a much better tool for what I want to do. Copy paste it is until I need to use macros.
Depending on your specific use case, creating a user-defined function may help:
use the Basic IDE to create your function;
apply it to any cells on any sheet;
modifying the Basic code will affect all cells where the function is used.
I've elaborated the steps in an answer on superuser.
Sure, you could write some complex code to update functions, but wouldn't the easy way be just to drag it to the same range of cells the same way you did before? It should properly overwrite the existing code in there, and if it doesn't, you can just as easily delete the outdated code and drag the new code in.
Probably the best approach is to simply drag the amended formula over the range of cells (as advised by OldBunny2800). This is less error prone and easier to maintain than a custom macro.
Another option would be to use an array function. Then you only have to edit the function once, and the same edit will be automatically applied to the whole range of cells in that array function.