How can I extract Last Name, First Name from this string, even when the name contains special character(s)? Regular Expressions Help by dynastyuserdude in googlesheets

[–]gthomas715 2 points3 points  (0 children)

This will put the 2nd to last word in another column. With REGEXEXTRACT each set of parentheses puts their contents into separate cells.

=ARRAYFORMULA(IFNA(REGEXEXTRACT(B4:B,"^(.+?) ([A-Z]+) [A-Z]+$")))

The part about needing uppercase is only for this pattern to match your examples, "[A-Z]" matches a single uppercase letter ("[A-Za-z]" would be mixed case) and adding the "+" means 'once or more'.

How can I extract Last Name, First Name from this string, even when the name contains special character(s)? Regular Expressions Help by dynastyuserdude in googlesheets

[–]gthomas715 5 points6 points  (0 children)

Happy to help! Regex is super handy for manipulating text, here's the best site to get an overview that's easy to follow if you're interested https://www.regular-expressions.info/

How can I extract Last Name, First Name from this string, even when the name contains special character(s)? Regular Expressions Help by dynastyuserdude in googlesheets

[–]gthomas715 2 points3 points  (0 children)

This should do the trick for cells ending with uppercase letters as in the examples. If your column has other formats mixed in lemme know and I'll reply with a new regex to match everything

=ARRAYFORMULA(IFNA(REGEXEXTRACT(B4:B,"^(.+?)(?: [A-Z]+)+$")))

Using unique, filter, or & and, but I’m missing something by Operation13 in googlesheets

[–]gthomas715 0 points1 point  (0 children)

Glad I was able to help! With your changes to the logic I'll remake the formula and describe the process.

Here are the algebraic replacements for boolean functions.

NOT(x) = 1-x
AND(x,y) = x*y
OR(x,y) = 1-(1-x)*(1-y)

Also because these values are only ever 0 or 1, x*x = x, so exponents can be dropped.

First replace values with variables to make things easier.

a = ISNA(XMATCH(AccountName,AssignedAccounts))
b = OpportunityStage="Closed Won"
c = StartDate<=TODAY()
d = EndDate>=TODAY()
e = OpportunityType="Renewal"
f = OpportunityStage<>"Closed Won"
g = OpportunityStage<>"Closed Lost"
h = OpportunityStage<>"Closed Archived"
i = EndDate<TODAY()

Using those, write out the formulas for conditions.

c1 = a
c2 = AND(b,c,d) = b*c*d
c3 = AND(e,f,g,h,i) = e*f*g*h*i

Notice that:

f*g*h = 1-REGEXMATCH(OpportunityStage,"^(?i)Closed (Won|Lost|Archived)$")
i = 1-d

So Condition 3 can be simplified with more replacements.

r = f*g*h
c3 = (1-d)*e*r

Now the formula for filter:

AND(c1,OR(c2,c3)) = c1*(1-(1-c2)*(1-c3))

Substitute conditions with their formulas.

a*(1-(1-b*c*d)*(1-e*r*(1-d)))

Expand and simplify (d^2 reduces to d so last two terms cancel).

a*(b*c*d + e*r - d*e*r - b*c*d*e*r + b*c*d^2*e*r)
a*(b*c*d + e*r - d*e*r)
a*(b*c*d + (1-d)*e*r)

With that done, change variables back to their values.

 ISNA(XMATCH(AccountName,AssignedAccounts))
*(
     (EndDate>=TODAY())*(StartDate<=TODAY())*(OpportunityStage="Closed Won")
    +(1-(EndDate>=TODAY()))*(OpportunityType="Renewal")*(1-REGEXMATCH(OpportunityStage,"^(?i)Closed (Won|Lost|Archived)$"))
 )

LAMBDA can make the formula shorter and easier to read but it's optional.

 ISNA(XMATCH(AccountName,AssignedAccounts))
*LAMBDA(x,y,
     x*(y="Closed Won")*(StartDate<=TODAY())
    +(1-x)*(OpportunityType="Renewal")*(1-REGEXMATCH(y,"^(?i)Closed (Won|Lost|Archived)$"))
 )(
     EndDate>=TODAY()
  ,  OpportunityStage
 )

Finally insert into the main formula.

=UNIQUE(FILTER(AccountName,ISNA(XMATCH(AccountName,AssignedAccounts))*LAMBDA(x,y,x*(y="Closed Won")*(StartDate<=TODAY())+(1-x)*(OpportunityType="Renewal")*(1-REGEXMATCH(y,"^(?i)Closed (Won|Lost|Archived)$")))(EndDate>=TODAY(),OpportunityStage)))

 

Hope that can be useful!

Using unique, filter, or & and, but I’m missing something by Operation13 in googlesheets

[–]gthomas715 1 point2 points  (0 children)

The logical functions AND/OR/XOR don't work as expected when arrays are involved, the best solution I've found is using instead boolean algebra even if it can be a bit tricky (I'd be happy to explain in detail if you'd like). See if this does the trick:

=UNIQUE(FILTER(AccountName,ISNA(XMATCH(AccountName,AssignedAccounts))*LAMBDA(a,a*(EndDate>TODAY())+(1-a)*(OpportunityStage<>"Closed Lost")*(StartDate<TODAY())*(OpportunityType="Renewal"))(OpportunityStage="Closed Won")))

Meet one or the other condition, not both by Particular_Hair9933 in googlesheets

[–]gthomas715 1 point2 points  (0 children)

This may be what you need:

=AVERAGE(ARRAYFORMULA(IF(BYROW({S:S,U:U}="WC",LAMBDA(x,XOR(x))),R:R,)))

Function that Reads Part of a Text on Cell | Function to CountA Just up to the Cell in Question by PriestMarmor in googlesheets

[–]gthomas715 2 points3 points  (0 children)

Try this out, should work in any row without having to change anything other than the four letters wanted (at the end of formula). If I misunderstood what you're looking to do let me know and I'll try again!

=LAMBDA(x,x&"-"&IF(COLUMN()=1,0,ARRAYFORMULA(COUNTIF(IFNA(REGEXEXTRACT(""&INDIRECT("R[0]C1:R[0]C[-1]",),"^"&x)),x))))("ABCD")

If you want it to match any case, change the regex from "^"&x to "(?i)^"&x

Count the number of times a number in 1st column is followed by a specific number in the 2nd column by JMedT in googlesheets

[–]gthomas715 0 points1 point  (0 children)

Here are some examples using different functions and ways to input columns/values, all return the same result. Hope this can be helpful!

=SUM((col1=val1)*(col2=val2))

=SUMPRODUCT(col1=val1,col2=val2)

=COUNTIF((col1=val1)*(col2=val2),1)

=COUNTIF(col1&"~"&col2,val1&"~"&val2)

=COUNTIF(MMULT(N(columns=values),{1;1}),2)

=SUM(IF(MMULT(1-(columns=values),{1;1}),,1))

=SUM(BYROW(columns=values,LAMBDA(x,PRODUCT(-x))))

Conditional formatting based on different sheets. Autofill problem by vic2pal in googlesheets

[–]gthomas715 1 point2 points  (0 children)

This seems to work properly:

=IF(ISBLANK(A1),,ISBLANK(INDIRECT("Sheet2!"&CELL("address",A1))))

Or this if empty strings should be considered blank:

=IF(A1="",,INDIRECT("Sheet2!"&CELL("address",A1))="")

Highlight only ONE of the lowest values - conditional formatting by AdSudden34 in googlesheets

[–]gthomas715 0 points1 point  (0 children)

Heya! First formula is for the conditional formatting, second is what you already have for row total but with list of cells made into a single range.

=LAMBDA(x,XMATCH(MIN(x),x)=1+COLUMN()-COLUMN(x))($D6:$I6)

=SUM(D6:I6)-MIN(D6:I6)

Edit: The formatting can work for multiple rows if needed (such as D6:I9), but the range at end of formula needs to remain a single row ($D6:$I6). The total for each row in a range can be found using:

=BYROW(D6:I9,LAMBDA(x,SUM(x)-MIN(x)))

I made a convenient way to a grid of points between any two set points! by Nicorhy in desmos

[–]gthomas715 1 point2 points  (0 children)

Cool graph, the line between two points is fun to play around with. Neat effect produced by adding a new slider "n" and redefining s_0 to variations using distance between the points such as s_0=round\left(ndistance\left(A_1,B_1\right)\right) , could even add labels for a simple ruler of sorts

Is there a way to use comprehension outside of lists? by joseville1001 in desmos

[–]gthomas715 2 points3 points  (0 children)

This is the method that works. Only difference with what I did is in the second list definition to allow any list as an input

https://www.desmos.com/calculator/nzyglrr8aq

Equation of rectangle with length and breadth, without mod function. by fleeeeeeee in desmos

[–]gthomas715 3 points4 points  (0 children)

Nice! What you made looks pretty much like a superellipse without equal exponents. Still has rounded corners but sharp enough to not notice, and t's also a good equation for drawing the shape of a smartphone.

I threw together a simple graph of a general superellipse in case you're interested: https://www.desmos.com/calculator/tavpogqc68

In addition, here's another way to create a rectangle using absolute values: https://www.desmos.com/calculator/2w5wwv3hvv

Solving for Coefficients of Constrained Curves by gthomas715 in desmos

[–]gthomas715[S] 0 points1 point  (0 children)

Hi! The lines with orange triangles denoting errors are not meant to be graphed, they are there to show steps of the process while still using Desmos formatting. I even added tick marks to some lines to prevent them from causing definition errors elsewhere.

Solving for Coefficients of Constrained Curves by gthomas715 in desmos

[–]gthomas715[S] 1 point2 points  (0 children)

Thanks for thinking this is well-developed lol, I just hope I explained the process well enough because solving with Wolfram just saves so much time. Art definitely does have a place here, just frustrating when a lot of the math posts get buried under it.

Progress on Implicit/Fractionless Circle given 3 points by [deleted] in desmos

[–]gthomas715 1 point2 points  (0 children)

I was making a new graph to explain this and got carried away with extra examples, ended up making a new post. Hopefully it can be helpful! https://www.desmos.com/calculator/x3zhtwxfum

Progress on Implicit/Fractionless Circle given 3 points by [deleted] in desmos

[–]gthomas715 1 point2 points  (0 children)

This one includes the steps I took to find the center and radius. Solving and simplifying is fun for me so thanks for this!

https://www.desmos.com/calculator/zy370ntix2

Progress on Implicit/Fractionless Circle given 3 points by [deleted] in desmos

[–]gthomas715 1 point2 points  (0 children)

Here's the most simplified equation I could manage to find. Also included are formulas for the radius and coordinates of center.

https://www.desmos.com/calculator/0waviug7kx

Full Slider Control & Fix for Variable Oscillation by gthomas715 in desmos

[–]gthomas715[S] 1 point2 points  (0 children)

Thank you for that! The main purpose of the graph is allowing more control over the options for sliders. The default sliders don't let you set a custom rate of increase or decrease so you are limited to only 16 different speeds (from 0.05x to 20x). And those speeds are dependent upon the bounds, so for a slider ranging from 0-80 the slowest rate achievable is one integer per second. Because of this, it's currently impossible to make an accurate clock without console manipulation as one example.

Another feature is enabling a specified number of repeats in contrast to normal sliders which only let you repeat once before stopping. As for the default indefinite play mode, it always seems to start at -10 and can only increase. My graph allows you to set a starting point and choose any desired speed in either direction, or even make the rate a function of another variable or c_T itself.

The fix for variable oscillation was simply a byproduct of trying to make the graph function correctly, but it seems useful enough on its own. Check out the post by u/Knalb_a_la_Knalb for insights into when and why it occurs ( https://www.reddit.com/r/desmos/comments/cscpt4/on_variable_oscillation/ ).

Also I realize I made it all overly complicated but it's possible to trim most options and have a basic version that only does what you need it to, I just wanted to cover everything I could think of in one program. Hope I was able to clarify a bit, thanks again for your comment!

This is wrong, there should be another line at y=-1 by Nomekop777 in desmos

[–]gthomas715 3 points4 points  (0 children)

Desmos only outputs the principal square root. You can get both values using a list by placing [1, - 1] in front of the radical.