What does -- (minus minus) do in Excel? [duplicate] - excel

This question already has an answer here:
Meaning of two minus signs together ("double unary")
(1 answer)
Closed 6 years ago.
In Excel I have two cells
A1 Gwen Stefani
B1 =SUMPRODUCT(--(A1:A10="Gwen Stefani"))
B1 records a value of 1 (it counts "Gwen Stefani" in cell A1)
My question is this: What is the -- operator called, for want of a better word, and what does it do?
Naturally looking up "--" in Excel help gets me 50,200 results of - which isn't helpful ;)

The (A1:A10="Gwen Stefani") evaluates to an array (TRUE, FALSE, FALSE, FALSE...). So you are multiplying it by 1 to get (1,0,0,...). The "- -" can be replaced by "1*" with the same result.

Related

Having hard time figuring out a formula in Excel for trimming symbols and moving to a next row [duplicate]

This question already has answers here:
Excel macro -Split comma separated entries to new rows [duplicate]
(4 answers)
Split comma separated entries to new rows [closed]
(2 answers)
Closed 1 year ago.
Before
1
2
3
4
11111-CZ20-00995
NiceFoodsCo
Installment
7789231;7652137
After
1
2
3
4
11111-CZ20-00995
NiceFoodsCo
Installment
7789231
11111-CZ20-00995
NiceFoodsCo
Installment
7652137
Basically I need it to remove the ';' and then move to next row with same data
Any advice would be appreciated, already tried VLookup, XLookup, Trim, Row, Substitute (and combination of all these)

Multiple returns for IF statement [duplicate]

This question already has answers here:
multiple excel if statements to produce value 1,2 or 3
(3 answers)
Closed 4 years ago.
Screenshot
I'm trying to use and if statement to return a possible 3 different values. I'm trying to determine if a customer re-ordered this year after ordering last year.
My results should be re-ordered, only 2018 or Q4 not Q1. My formula is : =IF(AND(I15>0,J15<1),"Q4 not Q1","Re-Ordered")
But as you can see I'm not sure if I should be adding an or statement or what the layout of the formula should be. Any help is greatly appreciated. Everything I've found on this keeps returning my statement as false.
An IF statement can only return 2 values, so if you want to return 3, you have to nest it inside another IF like this:
=IF(A=B,"A equals B",IF(A=C, "A equals C", "A does not equal B and A does not equal C"))
Based on your screenshot:
=IF(AND(I12>0,J12<1),"Q4 not Q1",IF(AND(I12>0,J12>0),"Re-Ordered","2018 Only"))

Convert String To Time Duration In Excel [duplicate]

This question already has answers here:
Converting Time Formats in Excel
(2 answers)
Closed 6 years ago.
May I know the way to convert "1 h 49 m 57 s" to 1:49:57 in Excel.
Thanks in advance
You can use this formula to replace letters to colons then convert text to value:
=VALUE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(A5," h ",":")," m ",":")," s",""))
After inserting the formula set the cell's number format to "time".

Excel If Else Formula comparing string values

First I'm no Excel formula guru..
I want to write a formula that is comparing 4 possible string values
such as: Up, Down, Left, Right
pseudocode would be say:
if a1="Up" and a2="Down" then 1.1
else if a1="Left" and a2="Right" then 1.1
else if a1="Left" and a2="Down" then .95
else if a1 = a2 then 1
I'd cover all the permutations..
I view it as 6 nested if tests
4 items to test/compare
6 tests emerge
1x2,1x3,1x4,2x3,2x4,3x4
=IF(1=2,do this,if(1=3,do this,if(1=4,do this,if(2=3,do this,if(2=4,do this,if(3=4,do this,value if every test fails))))))
I THINK Excel has a limit of 7 nested if formulas or perhaps even formulas in general.
Perhaps you're looking for something like this?
=IF("Test1"="","Equal1
","")&IF("Test2"="","Equal2
","")&IF("Test3"="","Equal3
","")&IF("Test4"="","Equal4
","")
Borrowed from basically the same question on SuperUser.

How to re-arrange string so that same characters are not next to each other? [duplicate]

This question already has answers here:
Lexicographic minimum permutation such that all adjacent letters are distinct
(6 answers)
re-arrange items into an array with no similar items next to each other
(3 answers)
Closed 8 years ago.
How to re-arrange string so that same characters are not next to each other and if there are many alternative sorting options we'll choose the one which is alphabetically sorted?
i.e.
AAABBBB -> BABABAB
AAABBB -> ABABAB
BCDDEEEF -> BCEDEDEF
BACHH -> ABHCH
Pseudo code or something would be useful.
A naive solution:
Find all permutations of the string
Find all that don't have repeating characters
Find the first alphabetically

Resources