I just want to get the sum of all the values on the left side and not include the date.
Try SUMPRODUCT(). Assuming, you have space after value.
=SUMPRODUCT(--LEFT(A1:A4,SEARCH(" ",A1:A4)))
What about:
=SUM(--TEXTSPLIT(A1:A4," "))
Hey, Try this, even the data is inconsistent with more spaces, this will work.
=SUMPRODUCT(LEFT(A2:A6,SEARCH("-",SUBSTITUTE(A2:A6," ",""))-1)+0)
A slight variation to the previous proposals for two reasons:
Don’t need to invoke SUMPRODUCT(). If - - has been used to force enumeration, then SUM() is sufficient.
While TEXTSPLIT() works, you’ll run into problems if your column length is one. TEXTSPLIT will create a horizontal array with multiple values if applied to a range with only one row, producing ambiguity and a potential error.
Thus:
=SUM(--TEXTBEFORE(A2:A6," "))
is more versatile.
Textsplit, Textbefore functions are available on office365. If the user is not using office365, sumproduct would be the preferrable choice.
Related
So I quite often find myself doing tasks on Excel which involve evaluating a text string as an array. Generally speaking I just use this:
Function EVAL(Ref As String)
EVAL = Evaluate(Ref)
End Function
So the formula will be, for example:
=EVAL("{"&CHAR(34)&SUBSTITUTE(TEXTJOIN(";",TRUE,MID(Index[Industries],2,LEN(Index[Industries])-2)),";",CHAR(34)&";"&CHAR(34))&CHAR(34)&"}")
The cells in this example will have contents like:
;Automotive;Rail;Energy;
;Automotive;Rail;
;Energy;
;Automotive;Aerospace;
(As it happens this is the precise problem I'm stuck on right now, though it has come up in different ways in the past.)
This has worked for me in the past, but I've been running into difficulties lately.
I have come to the conclusion it isn't working because application.evaluate, it turns out, has a character limit of 255. I've seen examples of VBA tricks to bypass this for text strings that are formulas rather than arrays, but copy-pasting those they don't seem to work for when I'm using it to interpret a text string as an array rather than as a formula.
Is there some trick to get this to work? (Or, indeed, is there some alternative method to achieve this altogether?)
Right, as per my comments, if you are using ms365, you could avoid your workbook to be xlsm just because you need to split values into an array. Make use of what is available with native functions, for example:
Formula in C2:
=TEXTSPLIT(CONCAT(A1:A4),,";",1)
Formula in D2:
=FILTERXML("<t><s>"&SUBSTITUTE(CONCAT(A1:A4),";","</s><s>")&"</s></t>","//s[node()]")
Note 1: As per time of writing you'd need to enable the BETA-channel to gain access to TEXTSPLIT(), and if I recall correctly your version (2203) is allowed to start using this function. Just google how to get access and update your Excel.
Both options can obviously be nested inside the UNIQUE() function.
Note 2: If at any point CONCAT()'s limits are reached (32767 characters, thanks #ScottCraner), maybe you can avoid using that with help of the lambda's helper function REDUCE():
=TEXTSPLIT(REDUCE("",A1:A4,LAMBDA(a,b,a&b)),,";",1)
Note 3: In case you can't update your Excel just yet, and you wonder how to use FILTERXML(), don't mind me refering you to another post I wrote a while back here.
IF(C5="","",IF(D5="",C5,IF(E5="",(SUM(C5:D5/2),IF(F5="",(SUM(C5:F5/3),IF(G5="",(SUM(C5:F5/4),IF(H5="",(SUM(C5:G5/5),IF(I5="",(SUM(C5:H5/6),IF(J5="",(SUM(C5:I5/7),IF(K5="",(SUM(C5:J5/8),IF(L5="",(SUM(C5:K5/9),(SUM(C5:L5/10))))))))))))))))))))
1.Trying to find an average based on number of trials(columns)
You probably want the AVERAGE() worksheet function.
=AVERAGE(C5:L5)
will give you an average of that range and automatically ignore blanks.
(Edited to reflect that the 7-level nesting limit has been expanded, but this solution is probably still the preferable way to go).
Something like following purely on the basis of the right number of parentheses? I have removed the ones around each SUM.
=IF(C5="","",IF(D5="",C5,IF(E5="",SUM(C5:D5/2),IF(F5="",SUM(C5:F5/3),IF(G5="",SUM(C5:F5/4),IF(H5="",SUM(C5:G5/5),IF(I5="",SUM(C5:H5/6),IF(J5="",SUM(C5:I5/7),IF(K5="",SUM(C5:J5/8),IF(L5="",SUM(C5:K5/9),SUM(C5:L5/10)))))))))))
Let me share the problem, where I am trying to decide the winner list comparing multiple parameters:
First of all, I need to compare the fault points. The less you have the better place you get. If the fault points are equal, then I need to compare the time. Comparing the time, the faster you performed the greater place you get (green column represents the right result).
I have used this formula:
=IF(AA16="";"";COUNTIF($Z$16:$Z$24;"<"&Z16)+1+SUMPRODUCT(--($Z$16:$Z$24=Z16);--($AA$16:$AA$24>AA16)))
However, I get a wrong comparison for the time parameter. My guess is that it is either a small issue I am having or the formula itself is completely wrong.
Thanks in advance.
Use this formula instead:
=RANK(Z16,Z$16:Z$24,1)+SUMPRODUCT((Z$16:Z$24=Z16)*(AA$16:AA$24<AA16))
See image for reference:
Looks like this might be helpful. They have an example related to breaking ties that I think will work for your scenario.
Excel Functions: Rank
If I use =Small({VALUE(DV147),VALUE(DZ147),VALUE(ED147),VALUE(EH147)},2) it does not work. But, if I use SUM and the Value(-----) amounts, it works. What am I doing wrong?
Note: The numbers are stored as text in those cells for other reasons.
A couple of ways:
=SMALL(VALUE(T(INDIRECT({"DV147","DZ147","ED147","EH147"}))),2)
or:
=SMALL(VALUE(T(OFFSET(DV147,,{0,4,8,12}))),2)
To answer your specific question:
What am I doing wrong?
The elements of an array constant need to be constants. Formulas/Functions cannot be components of an array constant. Although you can certainly use formulas to create an array, as shown by XOR LX in his answer.
Seems like it would be a simple thing really (and it may be), but I'm trying to take the string data of a column and then through a calculated column, replace all the spaces with %20's so that the HTML link in the workflow produced email will actually not break off at the first space.
For example, we have this in our source column:
file:///Z:/data/This is our report.rpt
And would like to end up with this in the calculated column:
file:///Z:/data/This%20is%20our%20report.rpt
Already used the REPLACE, and made up a ghastly super nested REPLACE/SEARCH version, but the problem there is that you have to nest for EACH potential space, and if you don't know how many up front, it doesn't work, or will miss some.
Have any of you come across this scenario and how did you handle it?
Thanks in advance!
As far as I know there is no generic solution using the calculated-column syntax. The standard solution for this situation is using an ItemAdded (/ItemUpdated) event and initializing the field value from code.
I was able to solve this issue for my circumstances by using a series of calculated columns.
In the first calculated column (C1) I entered a formula to remove the first space, something like this:
=IF(ISNUMBER(FIND(" ",[Title])),REPLACE([Title],FIND(" ",[Title]),1,"%20"),[Title])
In the second Calculated column (C2) I used:
=IF(ISNUMBER(FIND(" ",[C1])),REPLACE([C1],FIND(" ",[C1]),1,"%20"),[C1]).
In my case, I wanted to encode upto four spaces, so I used 3 calculated columns (C1, C2, C3) in the same fashion and got the desired result.
This is not as efficient as using a single calculated column, but if SUBSTITUTE will not work in your SharePoint environment, and you cannot use an event handler or workflow, it may offer a workable alternative.
I actually used a slightly different formula, but it was on a work machine to which I don't have access at the moment, so I just grabbed this formula from a similar S.O. question. Any formula that will replace the first occurrence of a space with "%20" will work, the trick is to a) make sure the formula returns the original string unchanged if it does not have more spaces in it, and b) test, test, test. Create a view of your list that has the field you are trying to encode, plus the calculated fields, and see if you are getting the results you want.
so that the HTML link in the workflow produced email will actually not break off at the first space.
The browser only does this if you have not enclosed your link in quotes
If you wrap the link in quotes, it does not cut off at the first space
In a SharePoint Formula it would be:
="""file:///Z:/data/This is our report.rpt"""
becuase two quotes are the SP escape notation to output a quote
You can use this formula (Start trim for 1, in my case was 4):
=IF(ISBLANK([EUR Amount]),"",(TRIM(MID([EUR Amount],4,2))&TRIM(MID([EUR Amount],6,2))&TRIM(MID([EUR Amount],8,2))&TRIM(MID([EUR Amount],10,2))&TRIM(MID([EUR Amount],12,2))&TRIM(MID([EUR Amount],14,2)))*1)