I have an Excel file that contains hundreds of rows and columns of delimited data. Every cell looks like these two sample cells, and it used alphas and symbols to represent a specific result:
2-0*0*8-15-8-T4-<2-D4-C4-$4-6-4->2-X4-^6-%-|0|-/P4
4-0*0*3-13-5-K3-<2-S3-C3-$3-11-7-999-M3-^1-+-|4|-/W3
Each piece of the data within the delimited structure refers to a testing result and each test is contained on a single row, ranging from about 50 to 600 cells.
My challenge is I need to come up with a way to get an average of the numeric values contained in the 16th delimited segment, the number contained within the pipes, for example "|0|" and "|4|" in the two examples above.
I have been using formulas such as this to count all the cells in a row that have both "S" and "/W" in the cell:
=COUNTIF('Test Data'!2:2,"*S*/W*")
But I cannot figure out how to get the average of the numbers contained within the pipes "|4|" etc.
Any help is greatly appreciated.
As #Max pointed out, TEXTSPLIT seems to be the best solution to your problem.
If you have to avoid TEXTSPLIT, here is an alternative:
=AVERAGE(IFERROR(VALUE(MID(data,SEARCH("|",data,1)+1,SEARCH("|",data,SEARCH("|",data,1)+1)-SEARCH("|",data,1)-1)),""))
which can be slightly shortened to
=AVERAGE(IFERROR(VALUE(LET(a,SEARCH("|",data,1),MID(data,a+1,SEARCH("|",data,a+1)-a-1))),""))
where 'data' is the array of rows and columns containing the test codes.
Related
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)
I want to give a two-column Excel file as input to my script. But I need a two-column Excel file to have one feature: the second column must have 10 characters. Because the number of rows in the Excel file is large, I can not manually edit every cell in the second column.
So I need to put a control function in Excel to check the second column, so that it counts the number of characters in each cell in the second column and adds zero to the right of it, which is less than ten characters.
Based on my search, I realized that I could use the definition of the condition and the Len function, but the output was not what I wanted.
Full ID Expected Result
15 0000000015
159 0000000159
16 0000000016
43 0000000043
4329 0000004329
What I had tried :
=Right(A2,LEN(A2)+8)
but it was wrong.
How can I get my expected results in like the top example?
One way is to use Rept to repeat the correct number of zeroes:
=REPT("0",10-LEN(A2))&A2
Or simpler to use Text:
=TEXT(A2,"0000000000")
The nearest to your original formula would be something like
=LEFT("0000000000",10-LEN(A2))&A2
Or better the formula suggested by #JvdV
=RIGHT("0000000000"&A2,10)
To be honest I wasn't sure if by simply formatting the data as "0000000000" the zeroes would be preserved if (for example) you wrote the sheet out as a CSV, but I have tested it just to make sure and in fact they are so I think this remains the optimal solution.
Test Sheet
Resulting CSV
I came across a question within which I have to extract variable numbers (1 or 2) of numbers from a cell only by using formulas.
I have looked at split functions, and left and right functions, but I don't think they are exactly aligned with my mission. Also, I am finding it challenging to figure out whether a cell contains 1 or 2 numbers by using formulas - no hardcoding.
This column of cells have values such as: "< 4.00%", "> 8.01%" or "4.01%-8.00%", and they mean a range of %numbers.
For the cells with one %number, I only have to extract that 1 value.
For the cells with two %numbers (i.e. 4.01 and 8.00), I have to extract 2 values.
How should I use formulas to extract the ranges (whether a cell has one %number of two - which I also have to figure out by using formulas)?
Thank you!
Based solely on what you provided:
=IFERROR(--TRIM(MID(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE($A1,">",""),"<",""),"-",REPT(" ",99)),(COLUMN(A1)-1)*99+1,99)),"")
Put that in the first cell, copy over and down then format as desired.
I haven't found any solution for the following problem:
I have a sheet with a single row of data with a unique ID, see below:
Question: How can i get the data organized like below? The name before the colon will be mapped to the row header like in the image.
The solution below assumes:
The number of columns in the input data is known (the solution assumes 5 columns are required after the Unique ID column)
The "attributes" ie the column headings to be used in the output is a known list
If an attribute appears more than once in an input row, only the value associated with the leftmost occurrence is used (see comment by Mrig)
The solution uses 8 basic Excel functions: FIND(), LEFT(), RIGHT(), TRIM(), LEN(), INDEX(), MATCH() and IFERROR(). If you want to understand how the solution works then you will need to understand these individual functions and what they do. The functions are combined into 3 basic formula for: (1) extracting the attribute part of the attribute:value pairs in the input data; (2) extracting the value part; and (3) getting the correct value into each of the output columns.
I have a large table of 12 digit numbers and associated info
I have a small list of 10 and 11 digit numbers (the first and/or last digits were cut off) - I'm attempting to cross these two lists to identify the items on the small list
normally, I'd use an index match to bring the associated info out of the table into the list, but because today I have only partial numbers in my list, I can't get the formula to work
I've seen other examples here that search for partial text strings contained within a range, but I haven't been able to adapt those formulas to my data. wildcards don't seem to work with numbers.
Many thanks for your input, and apologies in advance if I failed to find an existing solution on the site.
To match partial numbers inside a number range, like you do with strings, you can use an array formula with INDEX/MATCH, by composing a temporary array that converts the numbers into strings.
Say column A is your 12 digit numbers column, and you want to match the sequence 1234567890 and retrieve the value from column B, This CSE formula works:
=INDEX($B$2:$B$9999, MATCH("*1234567890*",""&$A$2:$A$9999,0))
CtrlShiftEnter
Although you can use full columns A:A and B:B, this should be avoided as much as possible with array formulas, because they're slow. Full columns mean computing and operating arrays of more than a million entries, so avoid it. Also note the "expensive" conversion from numbers to strings (all numbers in the $A$2:$A$9999 are converted to strings here).
To use a cell reference, say D2, instead of the harcoded 1234567890, the formula should be used like this:
=INDEX($B$2:$B$9999,MATCH("*"&D2&"*",""&$A$2:$A$9999,0))