I have a dimension that has this structure :, example: JIRA-525:Ticket Summary.
I'd like to extract the second part, but with no positive result.
I tried to create a custom field on that dimension and do a string operation, I know this won't give me expected result, but a basic string function is not working, as the grid is showing errors:
left([Concept].CurrentMember.Name,10)
What should I do differentñy?
The error message could give us some hints on what is wrong here. If you created a new calculated measure with the formula, it should return results.
Define a new calculated measure (measure not member, sometimes people mix them up) with the formula below:
[Concept].CurrentMember.AllProperties
Does that return any results with the dimension on rows? Does it have a "Name" property?
Ultimately, I would suggest creating a new calculated measure with ExtractString() function - https://docs.eazybi.com/eazybi/analyze-and-visualize/calculated-measures-and-members/mdx-function-reference/extractstring. But first see what properties are available.
If you are looking to change the dimension member names, then that can be done only with JavaScript calculated custom fields - https://docs.eazybi.com/eazybijira/data-import/custom-fields/javascript-calculated-custom-fields.
Related
Here is the sample workbook: https://docs.google.com/spreadsheets/d/1FqkXO8sdpeP9GPerdg8o2zcSiTV7o8gA-07iBvqw4Yw/edit#gid=1252102463
I'm working off the size tab but I have a "workingsize" tab that someone helped me with. The formulas in that sheet are working great.
ColN in Size corresponds to ColR in WorkingSize. In the absence of context, I'm looking for those two outputs to be identical and can't figure out how to get the formulas to behave correctly.
For more context on Size:
Eventually, the data entered into the red section will exist on an entirely different sheet. I'm good at referencing between sheets but just wanted everyone to be aware. This is the data I'm having trouble with.
in K6 & below, you enter in a type of pizza. right now it's free text but ultimately, it will be a drop down from the range A2:A. That range also matches the headers in F3:H3. In theory, as new items are added to the A2 range, new columns will appear here.
ColL is a number - it represents a dough ball weight.
ColM is identifying which column from the table to be searching against.
ColN then takes the weight, rounds it to the nearest value in the corresponding col for type, and then outputs the corresponding size.
ColN in Size is my attempt to take the formulas from colR in workingsize and turn them into an array.
You can try with XLOOKUP. With INDEX and XMATCH you narrow the weightes by the match on the name of the column. Then with MAP you can convert it in an array. Change the last -1 to 1 if you want to round it up instead of down:
=MAP(K6:K,L6:L,LAMBDA(type,wt,IF(wt="","",XLOOKUP(wt,INDEX(E4:H,,XMATCH(type,E3:H3)),D4:D,,-1))))
PS: I deleted the column of key value, since it was not necessary
UPDATE:
To find closest value, you can use this: it sorts D column by the absolute value of the difference between the corresponding column and the weight. SORTN and the first 1 returns only the first value, meaning the closest to the weight
=MAP(K6:K,L6:L,LAMBDA(type,wt,IF(wt="","",SORTN(D4:D,1,,BYROW(INDEX(E4:H,,XMATCH(type,E3:H3)),LAMBDA(d,ABS(wt-d))),1))))
Let me know!
Hi I have following table created for my trading journal.
As you can see from the formula,
I am matching a string Long or Short based on that I am calculating the values whether I made profit or loss.
Interestingly, in short position, The
value should be -4.88 i,e (204.9*48.7804878 - 205*48.7804878). But somehow I am not getting the negative symbol out. How to rectify this?
Simply use
=ifs(F3="Short",________,F3="Long",_________)
or
=ifs(REGEXMATCH(F3,"Short"),______,REGEXMATCH(F3,"Long"),________)
I want to iterate over an array of cells, in this case B5:B32, and keep the values that are equal to some reference text in a new array.
However, SPLIT nowadays accepts arrays as inputs. That means that if I use the array notation of "B5:B32" within ARRAYFORMULA or FILTER, it treats it as a range, rather than the array over which we iterate one cell at a time.
Is there a way to ensure that a particular range is the range over which we iterate, rather than the range given at once as an input?
What I considered was using alternative formulations of a cell, using INDEX(ROW(B5), COLUMN(B5)) but ROW and COLUMN also accept array values, so I'm out of ideas on how to proceed.
Example code:
ARRAYFORMULA(
INDEX(
SPLIT(B5:B32, " ", 1), 1
) = "Some text here"
)
Example sheet:
https://docs.google.com/spreadsheets/d/1H8vQqD5DFxIS-d_nBxpuwoRH34WfKIYGP9xKKLvCFkA/edit?usp=sharing
Note: In the example sheet, I can get to my desired answer if I create separate columns containing the results of the SPLIT formula. This way, I first do the desired SPLITS, and then take the values I need from that output by specifying the correct range.
Is there a way to do this without first creating an output and then taking a cell range as an input to FILTER or other similar functions?
For example in cell C35 I've already gotten the desired SPLIT and FILTER done in one go, but I'd still need to find a way to sum up the values of the first character of the second column. Doing this requires that I take the LEFT value of the second column, but for that I need to output the results and continue in a new cell. Is there a way to avoid this?
Ralph, I'm not sure if your sample sheet really reflects what you are trying to end up with, since, for example, I assume you are likely to want the total of the hours per area.
In any case, this formula extracts all of the areas, and the hours worked, and is then easy to do further calculations with.
=ArrayFormula({REGEXEXTRACT({C5:C9;D5:D9;E5:E9;F5:F9;G5:G9;H5:H9},"(.*) \d"),
VALUE(REGEXEXTRACT({C5:C9;D5:D9;E5:E9;F5:F9;G5:G9;H5:H9}," (\d+)hrs"))})
Try that in cell E13, to see the output.
The first REGEXEXTRACT pulls out all the text in front of the first space and number, and the second pulls out all the digits in a string of " #hr" in each cell. These criteria could be modified, if necessary, depending on your actual requirements. Note that it requires the use of VALUE, to convert the hours from text to numeric values, since REGEXEXTRACT produces text (string) results.
It involved concatenating your multiple data columns into one long column of data, to make it simpler to process all the cells in the same way.
This next formula will give you a sum, for whatever matching room/task you type into B6, as an example.
=ArrayFormula(QUERY({REGEXEXTRACT({C5:C9;D5:D9;E5:E9;F5:F9;G5:G9;H5:H9},"(.*) \d"),
VALUE(REGEXEXTRACT({C5:C9;D5:D9;E5:E9;F5:F9;G5:G9;H5:H9}," (\d+)hrs"))},
"select Col1, sum(Col2) where Col1='"&B6&"' group by Col1 label sum(Col2) '' ",0))
I will also answer my own question given what I know from kirkg13's answer and other sources.
Short answer: no, there isn't. If you want to do really convoluted computations with particular cell values, there are a few options and tips:
Script your own functions. You can expand INDEX to accept array inputs and thereby you can select any set of values from an array without outputting it first. Example that doesn't use REGEXMATCH and QUERY to get the SUM of hours in the question's example data set: https://docs.google.com/spreadsheets/d/1NljC-pK_Y4iYwNCWgum8B4NJioyNJKYZ86BsUX6R27Y/edit?usp=sharing.
Use QUERY. This makes your formula more convoluted quite quickly, but is still a readable and universally applicable method of selecting data, for example particular columns. In the question's initial example, QUERY can retrieve only the second column just like an adapted INDEX function would.
Format your input data more effectively. The more easily you can get numbers from your input, the less you have to obfuscate your code with REGEXMATCHES and QUERY's to do computations. Doing a SUM over a RANGE is a lot more compact of a formula than doing a VALUE of a LEFT of a QUERY of an ARRAYFORMULA of a SPLIT of a FILTER. Of course, this will depend on where you get your inputs from and if you have any say in this.
Also, depending on how many queries you will run on a given data set, it may actually be desirable to split up the formula into separate parts and output partial results to keep the code from becoming an amalgamation of 12 different queries and formulas. If the results don't need to be viewed by people, you can always choose to hide specific columns and rows.
I want to calculate the product of the investment returns (compound interest), which in this instance would give a return of 162%:
Additional stock return data will be added in future, so I need a formula that compounds every nth (2nd) value. I am able to sum the cells using:
=SUMIF(ARRAYFORMULA(MOD((COLUMN(A2:H2)-COLUMN(A2)+1),2)),0,A2:H2)
However I cannot find an equivalent 'PRODUCTIF' function and have not been able to make a formula that works. Writing the formula out long hand would be:
=B2*D2*F2*H2
Product formula should be like Sum formula but putting 1 for odd columns:
=ArrayFormula(PRODUCT(IF(MOD(COLUMN(A2:H2)-COLUMN(A2)+1,2),1,A2:H2)))
I guess i'm a little confused. doesn't PRODUCT() just ignore text?
Doesn't =PRODUCT(2:2) work?
You can also use the following formula:
=PRODUCT(TRANSPOSE(2:2))
and format the result as Percent from the menu
Functions used:
TRANSPOSE
PRODUCT
EDIT
As correctly noted by Mat, an even simpler formula can also give the correct results.
=PRODUCT(2:2)
I'm an AP Biology student and am trying to create a mathematical model for a Hardy-Weinberg lab using Google Spreadsheet. Here is the link to the spreadsheet. The problem is located on the "Gene Flow" tab on N111.
So I am trying to add all the number values above N until it hits a certain number. That quantity of organisms is dependent on the total number of organisms AFTER the migration of Generation 1. And that migration is just random chance of whether some will leave or arrive. By adding up the new generation, I need to calculate the genotypes of their offspring (a.k.a. Generation 2), assuming there is 1:1 ratio between each generation.
Here is the code I tried:
=SUM(N6:N(SUM(F107:H107)+6))
However, the error I receive is Argument must be an range.
Is there a way to properly express this through Google Spreadsheet?
You could use the INDIRECT function. It returns a cell/range reference with only a string as input. For example:
=SUM(INDIRECT("N6:N"&(SUM(F107:H107)+6)))