Excel - Find a Cell in an array and its location - arrays

Looking to figure out how to determine the address of a cell in an array based on a previously determined max value. See the attached picture:
What I'm looking for in this image is the cell directly above the minimum value of 192.02. Total minimum value is determined by finding the minimum across the row, then down in a column. I need to figure out how to bolt on a formula that will essentially find that location and move up one cell. Duplicates aren't an issue - the first match is sufficient.

Haaaaa... I found out a method using SUMPRODUCT, but it wasn't working out for me, reporting a circular reference. I couldn't figure out what the hell the issue was until I realized the "row check" formula extended infinitely to the right and I'd put the formula in a cell in that area - thereby making it an infinite loop. Embarassing.
The method I found was this, incidentally:
=SUMPRODUCT((K6:M20=H24)*(COLUMN(K6:M20)))
=SUMPRODUCT((K6:M20=H24)*(COLUMN(K6:M20)))
Where H24 is my minimum value and K6:M20 is the range. Then you can use INDIRECT with these values to get the value of that cell. In my case, I'd use
=INDIRECT(ADDRESS(ROW-1,COLUMN),TRUE)
To find the cell directly above that value. Sometimes just posting a question can solve it for you, haha.

Related

Scorecard absolute comparison with % symbol

I am trying to make a comparison between two different dates in the GDS and present that information in a scorecard.
I have done this in the past with no problem, but this time I want to do an absolute comparison. Although I checked the box to make it an absolute comparison, the information appears with a % sign after it. I would like to see a "p.p." after it or nothing at all.
How can I achieve this result?
You can find below an image of what is happening.
Thanks in advance!
UPDATE:
I solved the issue by aligning all the elements of that scorecard to the right and adding a text box in front of the % sign. It is not perfect, but it works.
Not the answer you're looking for, but I don't think this is currently possible. I had to add a disclaimer below the scorecards to indicate the comparison values are absolute (despite the percentages). Not ideal, but at least it shows the info

Possible gSheets ArrayFormula display bug

I can almost always find an answer here for a problem, but not this time so I'm asking the community.
I'm having a problem with ArrayFormula not displaying the text in the True branch of an IF when the condition evaluates to True. Instead it displays the text associated with the False branch.
The array formulas are all on row 4. I thought it might be caused by one of them referencing row 5 instead of row 4 and showing the result from the next row but that isn't it.
I thought it might be a corrupted sheet but after recreating in a new sheet the problem was still present.
It is easier to show than to explain so I've provided the gsheet and a short screencast below. A link to the screencast is also in A1 in the gsheet.
https://docs.google.com/spreadsheets/d/1H7W__hM2L89faxIOZ23WgboXHgaWe0wYT20aWVr_vD8/edit?usp=sharing
https://www.loom.com/share/a867787fdc6044a3840125e288d4cb8c?from_recorder=1
Thanks much for taking a look...
AND formula is not supported under ARRAYFORMULA
use multiplication:
=ARRAYFORMULA(
IF(D4:D="",,
IF(D4:D<0, "No Profit",
IF(H4:H/(G4:G+1)*D4:D<D1,
IF((C4:C>C1)*(E4:E>(C1*3-1)), "Low Profit"&
TEXT(H4:H/(G4:G+1)*D4:D, "$00"), "Low Price"), H4:H/(G4:G+1)*D4:D))))
also note that anchoring $ in "true" AF is kinda pointless

ARKit: Reproducing the Project Point function

I'm attempting to reproduce the ARCamera's project point function, but for some reason the values are not matching up properly. I am taking the ARCamera's projection matrix and view matrix and applying basic CG perspective transform math, (PV) * p, but the NDC values do not match the pixel values given from the ARCamera's project point function. Any ideas? Am I forgetting something?
Some more detail:
Basically, I'm trying to take an ARFrame a the click of a button, and then trying to replicate the functionality of https://developer.apple.com/documentation/arkit/arcamera/2923538-projectpoint. I'm attempting to do this with https://developer.apple.com/documentation/arkit/arcamera/2887458-projectionmatrix and https://developer.apple.com/documentation/arkit/arcamera/2921672-viewmatrix, making sure all of the inputs match for both parts. CG size is used to transform the coordinates from NDC space to image space.
EDIT: Solution found, check comments below.
The problem turned out to be projection_matrix sometimes does not correctly find the device orientation. The correct approach is to use projectionMatrix(for:viewportSize:zNear:zFar:).

Array constant in a formula with non-adjacent cell references

I need to add an array of non-adjacent cells to my array formula. I have tried all of the following array constant-like ways and they all give me a "There is a problem with this formula error".
'Chart Data'!{A12:A14,D3:D11}
{'Chart Data'!A12:A14,'Chart Data'!D3:D11}
'Chart Data'!{A12,A13,A14,D3:D11}
{'Chart Data'!A12,'Chart Data'!A13,'Chart Data'!A14,'Chart Data'!D3:D11}
'Chart Data'!{A12,A13,A14,D3,D4,D5,D6,D7,D8,D9,D10,D11}
{'Chart Data'!A12,'Chart Data'!A13,'Chart Data'!A14,'Chart Data'!D3,'Chart Data'!D4,'Chart Data'!D5,'Chart Data'!D6,'Chart Data'!D7,'Chart Data'!D8,'Chart Data'!D9,'Chart Data'!D10,'Chart Data'!D11}
Entire formula (the array constant goes where the {#####} is):
{=SUM(((1-References!M1:M12)*({#####}*(G3:G14+F3:F14-0.11)))+((References!M1:M12)*('Chart Data'!A12:A23*(G3:G14+F3:F14-0.11)))+((H2:H13*X3:X14)+(H3:H14*Y3:Y14)+(I2:I13*(V3:V14-X3:X14))+(I3:I14*(W3:W14-Y3:Y14))))}
I am 100% positive that it is this particular array constant that is causing the problem. I can't move the cells I'm referencing to put them in line. Is it even possible to reference a non-adjacent range in an array formula? If it's possible, what am I doing wrong?
There are several ways to do this. The following is very simple and pretty direct so my favorite.
EITHER choose a cell to build your string for your non-contiguous array in OR create a Named Range to do it. I'll show the first as it seems nicest for being able to use the mouse freely, but in both of them you can actually be creative using about how you build the string that will become your array. The main advantage of creating it in a Named Range is no helper cell lying about anywhere.
So, you create that string and then make it an array. Say you have a non-contiguous array needed using cells A12:A14 and C3:C11. You use joining and TEXTJOIN() like so:
="{"&TEXTJOIN(",",FALSE,B12:B14,C3:C11)&"}"
to create a text string of the values in those cells wrapped with the curly braces ({}) just as if you'd typed it in ("hardcoded it"). It will look like this with the right values in those cells:
{1,2,3,1,2,3,4,5,6,7,8,9}
but is ain't an array yet.
Now the magic in THIS method. Create a Named Range, perhaps called String2Array, and give it a formula of:
=EVALUATE(A1)
(or whatever cell you used for the above formula creating the text string that you want to be an array). Make the reference absolute. ($A$1... which it will do for you, just don't edit it to be relative. If you use this for similar work, but need it relative, that will work fine, but it just isn't what is needed here.)
Now replace your placeholder in the formula with the Named Range's name (perhaps you DID use String2Array). And you're done.
A couple other methods use INDEX() or CHOOSE() and you can force things to be arrays using the functions DOLLARDE() and IMREAL() (I found on a helpsite in a 2014 post) and some others do the same kind of thing. In those days, one had to use {CSE} too, but SPILL takes care of that now (with those two weird-seeming friendlies and at least two others). The poster was someone I've seen on this site, EXCELXOR was the name for the site, XOR LX was the name of the member here though the functions were mentioned in a comment by a Lori. Since he covers, it seems, aspects not usually covered in helpsites, looking up some of his work here, or elsewhere too, might be worthwhile to some folks.
But this method is very direct and therefore easy to maintain. And personally, I love the idea that EVALUATE() (must be used IN the Named Range functionality, not cell-side) is the gift that keeps on giving, one wonderfully helpful thing after another.
So many ways. You could even literally build the array in a helper column/row somewhere and reference THAT instead of the non-contiguous addresses. I like the joining+TEXTJOIN() approach best because I can use the mouse to easily get all the blocks into the formula since it is a LIVE formula. But you can type out a string fairly easily too and add the {}'s. Or perhaps a user would type a string of addresses and you'd add them like the formula does above. And you can insert actual values (constants) into the string you are building as well if that is appropriate. And you could build it formulaicly... I wouldn't pick that workload first thing off the pile of choices, but if you were going to do it anyway already, then... or if it's a small build.

Google Spreadsheet array not working

I'm not sure what I missed as my arrays are not working. Here's the link:
https://docs.google.com/spreadsheets/d/1_pPSRjEnKv10mDR8LICVvVv7jgXVBJ1aWZ8KrdEIKd4/edit#gid=0
Please check highlighted in green.
Thanks
Im not sure how to explain why it doesn't work because there are a list of things - various ways in which array formula operates - but I would like to suggest to you to use regexextract instead of search: I created the two formulas for is profile and is live, hopefully I can try to explain what the pieces do:
in column Y:
=arrayformula(if(arrayformula(if(istext(regexextract(C2:C,"automated")),1,0))+arrayformula(if(or(istext(regexextract(C2:C,"clinic profile")),istext(regexextract(C2:C,"dr profile"))),1,0))=2,1,0))
in column Z:
=arrayformula(if(Y2:Y=1,if(istext(regexextract(C2:C,"live")),1,0),0))
Basically instead of using the search - regexextract will find your search terms anywhere in that text and it works well with array formula, then using the if and istext to give it a true of false value of 1 or 0.
if the value is not found in that corresponding cell, it would in theory return #N/A if it was in an individual cell - but if the value is there the regexextract would return that value to you, which why the istext works
By the way if Im confusing you , then if you want to change your sheet to be editable by anyone I can jump in and show you what I did..

Resources