Getting error in split function inside array formula when using it with column title(array literal) - google-sheets-formula

I am using these functions in my google sheets. With an array literal, I am getting an error when there are comma-separated inputs which need to be split but its working fine when there is only value in the K column. It's working fine without column title. Can someone explain the error in the first code?
={"Don't Edit this Column TargetGroup ID";Arrayformula(IFERROR(SPLIT(MainSheet!K2:K,",",TRUE, True),""))}
and
=Arrayformula(IFERROR(SPLIT(MainSheet!K2:K,",",TRUE, True),""))

Try this one:
={
"Don't Edit this Column TargetGroup ID", Arrayformula(SPLIT(REPT(",", COLUMNS(SPLIT(MainSheet!K2:K,",")) - 2), ",", True, False));
Arrayformula(IFERROR(SPLIT(MainSheet!K2:K,","),""))
}
You had only one string value for the first raw in you array literal ({}), so it is only one column.
Presumably, SPLIT found at least one comma and gave you a minimum of two column range which cannot be attached to that first row of yours (the header string) from the bottom as they do not match column-wise.
This SPLIT(REPT(...), ...) gives a needed number of empty cells to append to the right of your header so the number of columns will match.
If that is not the case then please provide a error message or, even better, share a sample sheet where this issued is reproduced.

Related

Match part of the text and replace with another text in excel

I've data table with list of names which are having few differences. I am trying to change those text to similar name within data table as image in below.
If part of the text in cells in data table are matching with the "Abbreviations" list(Col-AK) then Data table text must replace with the text in "To be replaced" (Col-AL) into "Expected Return Table". I've tried using may different functions to accomplish my ultimate target, but none of them is giving perfect answer.
Can anybody help me with this problem.
I found an answer to my problem. I could do this using below formula.
Step 01:- I've used below static formula at first to identify the dynamic formula
=IF(LEFT(AC2,4)=$AK$2,$AL$2,AC2)
Step 02:- Then I've used Index function to return the first text in abbreviation list which is Iodine by only changing partial of the formula to return only single value avoiding others. Ex: Firstly I considered only about the Iodine in the list. This will only replace Iodine into the expected data table.
=IF(LEFT(AC2,4)=INDEX($AK$2:$AK$11,1),$AL$2,AC2)
Step 03:- Then row_num turned into dynamic and expanded the return text data into range($AL$2:$AL$11) from single($AL$2) using Match & Left function as below.
=IF(LEFT(AC2,4)=INDEX($AK$2:$AK$11,MATCH(LEFT(AC2,4),$AK$2:$AK$11,0)),INDEX($AL$2:$AL$11,MATCH(LEFT(AC2,4),$AK$2:$AK$11,0)),AC2)
Step 04:- Finaly ignore errors using IFERROR Function.
=IFERROR(IF(LEFT(AC2,4)=INDEX($AK$2:$AK$11,MATCH(LEFT(AC2,4),$AK$2:$AK$11,0)),INDEX($AL$2:$AL$11,MATCH(LEFT(AC2,4),$AK$2:$AK$11,0)),AC2),"")
Expected Return Data Table as shown below.

Weka NumericToNominal attributeIndices

I am using the Weka GUI and imported a csv file.
I want to transform a numerical attribute to nominal with the "NumericToNominal"-filter.
There are values between "-1" and "770".
If I set the attributeIndices value to "first-30,31-100,101-150,151-last", I get the error message: "Problem filtering instances: Invalid range list at first-30".
Do you have any idea, what is wrong?
Thanks in advance
I have just used the same NumericToNominal filter because I read in a csv file from the UI and it claimed everything was numeric.
You are using the -R switch and so it is looking for the range of column numbers. The values in whatever columns should not matter. Columns begin at 1 or first as you have above. The error message you get "Invalid range list" is when you reference a column number that does not exist. Therefore, it seems to indicate that either you have less than 30 columns or one of the columns between 1 and 30 has somehow been removed.. Did you mix up column numbers with the values contained within said columns because I believe having a negative value would not be a problem for this process?

Google spreadsheets in-cell string length validation

I have a column where I want to write down numbers, but the numbers are long, 25 characters, and I could miss type it so at least knowing that I have typed the correct amount of characters would be helpful.
When typing in Google spreadsheets, I can validate the answer of a column within another column by using: '=IF(LEN(B1)=25,B1,"wrong number of digits")'
which means it would return the cell value if has 25 characters, but if its any other amount it will say wrong number, yet I need to use another column...
Is there any way that while I am typing in a cell it would let me proceed if right number of characters or give an error if I have wrong number of characters, in the same column?
UNTESTED
Please try a Data, Validation..., rule of:
=and(B1>999999999999999,len(B1)=25)

How to sort only those rows which have no blank cell?

I have a Google Spreadsheet with two separate sheets. The first one is just a big list of names and data, and the second is supposed to be a sorted listing of all the data on the first sheet (sorted by, say, last name). Here is the current way I am defining the second sheet:
=sort(sheet1!A2:L100, sheet1!D2:D100, TRUE)
Which works fine for the most part, except for one issue: in sheet1, some of the cells in 4th column (column D) are blank. How can I change the formula so that the sorting ignores such rows which has a blank cell in column D?
The formulas i tried but got undesirable results :
=arrayformula(if(istext(sheet1!D2:D100), sort(sheet1!A2:L100, sheet1!D2:D100, true), ""))
It sorted as desired but with one issue - blank cells were not pushed at the end but scattered in between the rows.
=arrayformula(sort(filter(sheet1!A2:L100, istext(sheet1!D2:D100)),sheet1!D2:D100, true))
Though the filter part does its job perfectly but when coupled with sort, it is giving an error : Mismatched range lengths.
To filter out the rows with blank cells in column D, you could do something like #2, but as the error message suggested, the second argument would need to be filtered as well to ensure the ranges are the same length. Fortunately there is an easier way, and that is to use column indices rather than ranges:
=SORT(FILTER(sheet1!A2:L100;ISTEXT(sheet1!D2:D100));4;TRUE)
Alternatively you can use the QUERY function for this sort of thing:
=QUERY(sheet1!A2:L100;"select * where D != '' order by D";0)
For anyone looking this, the accepted answer works great if filtering out blank cells that are truly blank, but if the cells contain formulas that evaluate to blank (""), ISTEXT will evaluate to TRUE and blanks will not be filtered out. I modified the accepted answer slightly to work in my situation, in which I had cells containing formulas (that evaluated to "") that I wanted to filter out:
=SORT(FILTER(sheet1!A2:L100,sheet1!D2:D100 <> ""),4,TRUE)

Split a Value in a Column with Right Function in SSIS

I need an urgent help from you guys, the thing i have a column which represent the full name of a user , now i want to split it into first and last name.
The format of the Full name is "World, hello", now the first name here is hello and last name is world.
I am using Derived Column(SSIS) and using Right Function for First Name and substring function for last name, but the result of these seems to be blank, this where even i am blank. :)
It's working for me. In general, you should provide more detail in your questions on places such as this to help others recreate and troubleshoot your issue. You did not specify whether we needed to address NULLs in this field nor do I know how you'd want to interpret it so there is room for improvement on this answer.
I started with a simple OLE DB Source and hard coded a query of "SELECT 'World, Hello' AS Name".
I created 2 Derived Column Tasks. The first one adds a column to Data Flow called FirstCommaPosition. The formula I used is FINDSTRING(Name,",", 1) If NAME is NULLable, then we will need to test for nullability prior to calling the FINDSTRING function. You'll then need to determine how you will want to store the split data in the case of NULLs. I would assume both first and last are should be NULLed but I don't know that.
There are two reasons for doing this in separate steps. The first is performance. As counter-intuitive as it sounds, doing less in a derived column results in better performance because the SSIS engine can better parallelize the operations. The other is more simple - I will need to use this value to make the first and last name split so it will be easier and less maintenance to reference a column than to copy paste a formula.
The second Derived Column is going to actually perform the split.
My FirstNameUnicode column uses this formula (FirstCommaPosition > 0) ? RTRIM(LTRIM(RIGHT(Name,FirstCommaPosition))) : "" That says "If we found a comma in the preceding step, then slice out everything from the comma's position to the end of the string and apply trim operations. If we didn't find a comma, then just return a blank string. The default string type for expressions will be the Unicode (DT_WSTR) so if that is not your need, you will need to cast the resultant into the correct string codepage (DT_STR)
My LastNameUnicode column uses this formula (FirstCommaPosition > 0) ? SUBSTRING(Name,1,FirstCommaPosition -1) : "" Similar logic as above except now I use the SUBSTRING operation instead of RIGHT. Users of the 2012 release of SSIS and beyond, rejoice fo you can use the LEFT function instead of SUBSTRING. Also note that you will need to back off 1 position to remove the comma.

Resources