Find a Special Value in Any Columns Using Python-Pandas - search

I want a find a string available in column, without giving info of column names:
For example I have character '|S|' , I want the column where the character is present and I want the before columns too

Related

Functions or VBA script to split one column in two based on content

what would be the easiest way to do this?
The data has thousands of rows.
The data in M column is merged by data provider. I need this data split into separate columns for import.
Criteria to split:
Column one, named "R":
The capital letter values are either either a.) R or b.) RS
There are no blanks
Column two, named "Guidance mark":
Values to split are values in the "exponent" after either R/RS.
These can be values or blanks
Tried googling a lot of possible solutions, however didn't manage to find how to split this
You can use this formula:
=LET(d,A1:A4,
R,IF(LEN(d)>2,LEFT(d,LEN(d)-4),d),
gm,IF(LEN(d)>2,RIGHT(d,4),""),
HSTACK(R,gm))
It handles first the R- column retrieving the first letters except of the last 4.
Then the retrieve the last four characters for guidance mark.
Finally puttin them into a new array (HSTACK)

Write data from a list if the adjacent cell contains certain string

I need to update hundreds of cells, and that would be trivial automating, but I am not being able to make it work.
I have a list like the following:
And, in a different tab, a list I have to populate with values above (in B) based on the appearance of the twitter handle in other column.
The names are within a long text string (all of them begin with #), and it is not possible to re-order the list based on those names. Also, there are more names than values, so some cells will remain blank.
Is there a way I can write a formula that writes the values of the first list into the second one if the name in column A in that row is contained within the adjacent string?
Thanks!
You can refer to this sample formula (Same sheet was used):
=arrayformula(if(C2:C<>"",iferror(vlookup(REGEXEXTRACT(C2:C,"\B\#\w+"),A2:B,2,false),""),""))
What it does?
Use array formula to loop column C values
Extract the twitter name (string that starts with #) using Regexextract()
Use the extracted #twittername as search key to get the connections value using vlookup()
Output:
Since we don't have access to the spreadsheet, I can't know for sure what the line-break character is within the Col-A cells of your second sheet. And using this line-break character is important, since Twitter handles may use some non-alphanumeric characters such as the underscore and others which are not included in such REGEX notation as \w. I'm assuming here that the line-break character is CHAR(10) from the ASCII chart.
I also don't know the name of your first sheet; so here, I've just written it as Sheet1. You'll need to replace that with your actual sheet name, remembering to place it in single quotes if it contains anything but alphanumeric characters (e.g., 'Data Sheet').
That said, delete everything from Col-B in your second sheet (including the header "Connections") and place the following formula in cell B1 of that second sheet):
=ArrayFormula({"Connections"; IF(A2:A="",, IFERROR(VLOOKUP(REGEXEXTRACT(SUBSTITUTE(A2:A,CHAR(10),"~"),"#[^~]+"),Sheet1!A:B,2,FALSE)))})

Match function in Excel returns N/A

I have the following 3 columns in my excel sheet. The dates in column A (DateTime) are in the same format as column N(DateTime2) :
Example of Excel matrix
The data are a lot, so I can't check it one by one. I tried to use match command in order to identify which date from column N(DateTime2) exist in column A(DateTime). I used the following command:
=MATCH(N2;$A$2:$A$5849;0)
I used autofill and as a result I got only first value as a number (which means that it exists), and the rest as N/A ..which is wrong. As you can see the value 1/1/16 3:00 exist in both columns.
I tried then to use the function VLOOKUP and I wrote the following command:
=VLOOKUP(N2;$A$2:$A$5849;1;FALSE)
I got the same outcome.. I checked one random value (1/1/16 3:00) to check if the two cells with the same value are equal using the command : =A3=N5 and I got TRUE ..which means that the two cells are matching.
What do you think? What is the problem?
First check that either both columns are numeric values formatted as dates or both columns contain text.
If you imported the data, sometimes different characters are used for Space. Try a find and replace (ctrl+H). Enter a Space character in both the "Find what:" and "Replace with:" fields.

Match lookup value lengths for match with beginning of lookup value

In Excel 2013 I have two tables.
The first contains alpha numeric codes that vary in length.
Some examples from first table:
12345.12345
12346-12345
12AB1234
123.123
23456.123
A1234567.012
01234.12345
The second table contains alpha numeric codes I need to match with the beginning of the codes in the first table. Any numeric codes are currently stored as text.
Some examples from second table:
12345
12346
123
23456
A1234567
01234
How do I return a value from a different column in the second table containing any value? And for some context, the return column from the second table contains a description of for the codes.
I did not jet manage to find a solution using vlookup or match.
Also looked at using wildcards, but this only works one way, the wrong way.
The quickest solution, assuming you dont care about letters, is to use a LEFT(FIND( with substitution. If letters need to be excluded, then explanation will need to be provided how the format should be presented.
Solution: =IFERROR(LEFT(A2,FIND(".",SUBSTITUTE(A2,"-","."))-1),A2)
This formula will find the first "." or "-" and present all characters prior to. If none are found, then it will display the full ID.
If letters need to be removed as well, however, it should be noted that the use of some serious substitute nesting, or VBA script will be required.
A1 is the first cell in your column, in B1 write the following:
=LEFT(A1,MATCH(TRUE,ISERROR(VALUE(MID(A1,ROW(INDIRECT("1:"&LEN(A1))),1))),0)-1)
press Ctrl+Shift+Enter at the same time (Array Formula)
it will return the first numeric part of your Data
you can copy paste values in column C and compare with the second table
To have the result in Table1 directly in B1 use:
=IFERROR(INDEX(Sheet2!$A$1:$A$4,MATCH(VALUE(LEFT(A1,MATCH(TRUE,ISERROR(VALUE(MID(A1,ROW(INDIRECT("1:"&LEN(A1))),1))),0)-1)),Sheet2!$A$1:$A$4,0)),"")
press Ctrl+Shift+Enter at the same time (Array Formula)
It will return the corresponding number from Table2 (sheet2) if matched or "" empty if no match
Change A1:A4 to correspond all your Numbers in Table2 and keep the $ to fix the references when you drag down the formula

how to concatenate based on a slash

Is there a way to concatenate based on a specific character? I've used concatenate in the past based on x number of characters from the left, for example, but I need to concatenate based on a slash.
For example,
In column a I have part numbers such as 09-K1450V/XXL, 09-K1450V/XXXL, 16-150V/L
16-150V/M, 16-150V/S. What I'm building is a description field that should first contain the size information. So I'd like to pull all information after the slash in column a.
The formula you want is:
=MID(A1,FIND("/",A1)+1,LEN(A1))

Resources