Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 months ago.
Improve this question
I'm trying to find an average of a large array of candidates compensation. Some of the cells contain text with multiple numbers showing a range such as, "$100k - $120k". Others are labeled as TC("120k TC") for total composition.
How would I be able to find the average of these numbers by using a something along the lines of substituting letters or parsing the string into a number WITHOUT changing the actual values listed? I do NOT want to mutate the original cell value of I only want to find an average of them all through a formula to bypass the additional "k", "TC" and "-" rendering them un-averageable as they are not parsed as numbers.
Would need to clean up the texts in stages.
find if a certain text is present: eg.
=IF(IFERROR(FIND("-",A1,1),"")<>"","- is present","")
=IF(IFERROR(FIND("TC",A1,1),"")<>"","TC is present","")
=IF(IFERROR(FIND("$",A1,1),"")<>"","$ is present","")
then split left and right price values if "-" is present: eg.
=LEFT(A1,FIND("-",A1,1))
=RIGHT(A1,FIND("-",A1,1))
then if texts are present, remove those texts: eg.
=SUBSTITUTE(A1,"-","")
=SUBSTITUTE(A1,"$","")
=SUBSTITUTE(A1,"k","")
then can use trim() to remove spaces on ends, value() to convert text to number etc...
Related
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed last month.
Improve this question
I know we can easily convert or change the attribute to of data in a cell quickly and there are shortcuts for it but is there a way to check if a data or list of data in a column is saved as an int/string/date/etc?
I would like to be able to just quickly check if the data I have in a column is saved in the correct format/attribute without having to convert/change it again just to make sure.
Excel will make assumptions of what the data is automatically. There is no datatype like in python or other coding languages. There are functions for testing cells values.
Functions to look at istext(), isblank(), isnumber(), islogical(), iserr(), ...
so if you want to know the data type in B5.
=IFS(ISTEXT(B5),"String",ISBLANK(B5),"Null",ISNUMBER(B5),"Number",ISLOGICAL(B5),"Boolean",ISERR(B5),"Error")
To convert a number to a string use the single quote mark prior to the number like '50. A date in excel is also a number. To convert a number stored as a string into a number multiply by 1.
Edit---
There is a fuction =Cell() see the details here
=CELL("format",B5)
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
Hi I have a huge set of data with thousands of columns, one of the column I need to extract certain string patterns: e.g. 41242456-2020-12 or 41242456-2020-2 or 41242456-2020-200 (8 digit number-year-1~3 digit number), that was mixed among text in the string, e.g. most of times the numbers appear in the beginning, sometimes its like the following:
Blah Blah LEX#41242456-2020-12BLABLABLAH
Blah Blah LEXIDA ID:41242456-2020-12BLAHBLAHBLAH etc.
Hence unable to extract them fully through one formula.
Is there a way I can use any formula/vba code to only extract 41242456-2020-12 and removing all other characters?
Look here and elsewhere on the web on how to use regular expressions in Excel.
The regular expression you want to match against is \d{8}-[12]\d{3}-\d{1,3} which means
eight numbers
a dash
a "1" or a "2" (because if it's 3, or 0 then I assume it's not a valid year)
three numbers
a dash
one to three numbers
You might want to use (\d{8})-([12]\d{3})-(\d{1,3}) so that matching will give you the three numbers for you. Parentheses in regular expressions mean 'return what matched this part.'
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I need some help here to convert a file into a new file with below requirement:
Split each row (long string) into sub-string based on fixed length
use pipe delimiter "|" between each sub-string
leave last undefined column (sub-string) as-is, but add "|" before it.
Here is example, suppose a file (test.dat) has 2 rows:
PG123ABCD A 000{000
MK789HJKL32H00
Column 1: length(2)
Column 2: length(3)
Column 3: length(4)
Column 4: length(3)
Column 5: undefined, use all remaining value
Below is the final output I need. The example has only 2 rows, suppose I have a file that have 1k+ similar rows, and I need to convert original file to a new file based on above requirement.
PG|123|ABCD| A |000{000
MK|789|HJKL|32H|00
cut -b 1-2,3-5,6-9,10-12,13-500 --output-delimiter='|' test.dat > 1.dat
I wrote above code and it output exactly what I need.
The only question I have is last column, I used 13-500 as fixed length for the undefined column, however the length of the undefined remaining string varies in different rows, is there a generic way to define the last column's length? e.g., something like 13-max_lengh_of_the_row
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I have data of order 4096*2 in excel. Second column contains all alphanumeric values of the kind 10ABC1101, 10CDE1101 and 20FGH2345. I am looking for a method (using Excel functions only and not VBA) to assign a unique integer value to each alphanumeric value in column 2.
Plan is to take data into Matlab for some analysis (and avoid String handling within Matrices) and bring it back to Excel and convert integers into original alphanumeric strings.
Ps: I am new to both Matlab and Excel.
Clearly separating numbers from strings will not help me because that does not assign unique value.
Many Thanks.
For non-consecutive Unique IDs you can use (in column C)
=MATCH(B:B,B:B,0)
To get the string back
=INDEX(B:B,C:C)
Note: these formulas use Implicit Intersection see here for some info
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I have a Excel spreadsheet in which one column is for accession numbers. While importing the accession numbers, the person imported the filenames instead of just numbers. So now the accession 'numbers' look like:
SRA002989.sra
SRA002986.sra
....
Is there a way to strip off the extensions and just keep the first part like SRA002989, SRA002986 etc.?
Try using the SUBSTITUTE() function. If your data is in Column A, the following will work and can be copied around as necessary.
=SUBSTITUTE(A1,".sra","")
The simplest approach would be to select the column, press CTRL + H for search and replace and to search for ".sra" and replace it with an empty value (just leave the second field empty).