We have a column of data that someone appears to have inadvertently deleted 0 from a string of characters. e.g. ABCDEF 1 when the data should read ABCDEF01.
The length of the data is each cell varies in length. How do i check for a space between a string and if it exists to insert the value 0?
I'm assuming the first space to appear is the space you want to replace, if this is the case then this is possible to do.
If your values are in column A, you can do this by searching for the first instance of " ", then using the replace function to put a 0 there.
As follows: =REPLACE(A1,SEARCH(" ",A1,1),1,0)
Related
I need help with an Excel formula. I have to find the cell value based on a comma separated value list in another cell
For e.g Here G5 will have the max of Estimated End Date column (H) whose ID column contains values 1 or 2 (comma separated list in E5). Again above is e.g. there could be more than 2 values in the list
so G5 here should be 09/03/22 since it is max of 04/03/22 and 09/03/22.
We normally only respond to questions that include code or formulas we can work from (it's probably why you've received a downvote). However, in this case, I can see how you wouldn't know where to start.
Assuming you have Excel 365, the steps are:
Convert CSV to array
Map the array to found row numbers
Grab the max of the resultant array
I don't have the TEXT_SPLIT function, so I have to roll my own. I have a few helper functions for this (note these are saved as Names, in Formula->Define Name, so you'll need to add them).:
csvText
=LAMBDA(txt,"," & txt & ",")
csvCount
=LAMBDA(txt,LEN(txt)-LEN(SUBSTITUTE(txt,",",""))-1)
csvPosOf
=LAMBDA(n,txt,FIND("#",SUBSTITUTE(txt,",","#",n)))
csvLenOf
=LAMBDA(n,txt,csvPosOf(n+1,txt)-csvPosOf(n,txt)-1)
csvArray
=LAMBDA(txt,MAKEARRAY(1,csvCount(txt),LAMBDA(r,c,TRIM(MID(txt,csvPosOf(c,txt)+1,csvLenOf(c,txt))))))
This covers the splitting of your csv text to an array.
The mapping of the IDs to row numbers and MAX call is simply this formula:
=MAX(MAP(csvArray(csvText(C3)),LAMBDA(v,INDEX($A:$H,MATCH(VALUE(v),$A:$A,0),8))))
You'd add this formula into each row of your G column. Again, adjust the cell references as you need them. Please note you must call the VALUE function on the LAMBDA expression, as you can't implicitly MATCH a text representation of a number to an actual number.
I would like to use the =indirect() and =value() function together. I am to count how many numbers are > 0 in another sheet, in the rows I:I. In these sheets, the numbers are not formatted as values, and I am not to do this manually.
In addition, for the numbers, they are formatted as
" 123 "
With a space before the number.
I also need to remove the space in front the numbers in order for this to work.
In my current sheet, in cell J1, I have written "I:I". In the cell A3, I have the name of the sheet that I would like to count the numbers from.
My attempt so far:
{=COUNT.IF(INDIRECT("'"&A3&"'!"&$J$1);">0")
However, this just returns values 0. This is because there is a space infront of the numbers. How do I remove this space? I need to implement it in this function
I've edited the post a bit, as I noticed there was a space infront of the numbers
On a worksheet, if your value " 123 " is in cell A1 then you could use a formula like:
=VALUE(TRIM(A1))
...to TRIM the spaces, and convert the string to a numeric VALUE.
Or, in VBA, something like:
myValue = CInt(Trim(myString))
...to Trim the spaces, and Convert to CInt-eger.
Or, in many ad-hoc situations it's easiest to use "Text to Columns" to remove padded spaces (or any other character, really).
More ways to convert text to numbers here and here.
More ways to remove unneeded spaces here and here.
having this data in excel cell
kerass(xcvbn=2, abcdefg_iD='510863005')
having 100000 of records so, how to extract id number using excel formula from that excel sheet
Thanks in advance
Assuming your value is in cell A2. Here is a formula to be inserted
=SUBSTITUTE(RIGHT(A2,LEN(A2)-SEARCH("_iD='",A2)-4),"')","")
This means:
Search for "_iD='"
Once found, subtract the length of "_iD='" of that location (hence the 4)
Use the total length of the string, subtracted with location and 4, in order to find where the actual identifier begins
Take the right part of the string, only the part behind "_id='...'" remains
In that part, replace "')" by an empty string (otherwise you get "...005')"
Alternative answer:
=MID(A1,FIND("'",A1)+1,9)
The find formula finds the first "'" starting position
Assuming all the ID's are 9 digits, the MID formula uses the starting pos. from find and takes the following 9 digits.
So assuming your text is in cell A2, and that the id is the first 9 characters of the last 11 then this is the simplest I can think of:
=LEFT(RIGHT(A2,11),9)
But if extra characters get added or the ID changes length.
Does have the benefit of being minimalist on functions and low volativity.
I am trying to have Excel print 'X" in a table column based on if a specific value is found in a comma separated string given to me from a Microsoft Form.
I removed the characters I don't want, and now my comma separated string is just that, comma separated only.
I have tried a formula where if I search the string and it finds the value I am looking for, it returns to the corresponding table column with 'X'.
Original Output from Microsoft Forms:
["ViewPoint","B2W Estimate","Nektar Equipdata"]
I have used this formula to strip characters that I don't want/need.
=SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(Applications[Applications], "[", ""),"""",""),",",", "),"]","")
This is the formula I am trying to use to get the corresponding column to input what I want.
=IF([Column7]=(SEARCH("ViewPoint",[Column7])),"X","")
Here is the expected and the actual result :
Expected Result: "X"
Actual Result: "#NAME?"
This should work, if i understand your question correctly.
=IF(ISNUMBER(SEARCH($B$1,A4)),"X","-")
If you want the total number of occurances in the column, you need this ARRAY Formuly CTRL + SHIFT + ENTER
=SUM(ISNUMBER(SEARCH($B$1;A4:A7))*1)
I believe you get he #NAME? result if the searched item doesn't contain the string of interest, because it is checking "Does myString = #ERR ?"
In addition to the other answer, you could also try:
IF(ISERROR(SEARCH(...)),"X","-")
There are two types of values in cell A of my spreadsheet
Value type 1: Have a space in between the postcode district and sub postcode, as the postcode district is less than ten (i.e. MK1-MK9)
MK1 1AS
Value type 2: Have no space in between, as the postcode district is greater than ten (i.e. MK10-MK46)
MK170DB
What would be the best way of splitting the second group of values into something like this:
MK17 0DB
I was thinking of some pseudo code in the the vein of:
if the value at the 4th character (counting from the right) in MK170DB is not an empty space
then count 4 spaces and create an empty character, leaving it like this MK17 0DB
if not then presume that the 4th character is a empty space (i.e. MK1 1AS) and leave it
As I just need to run this operation once to cleanse my data, I was thinking about creating a formula in column B that references column A and does the necessary cleansing. I would then replace the values in col A with what I have in col B.
Can anyone tell me whether the logic I have proposed can be executed in Excel or if there is a better way of doing it?
Thanks.
With your data in A1, in B1 enter:
=IF(ISERROR(FIND(" ",A1)),LEFT(A1,4) & " " & MID(A1,5,999),A1)
Something I came up with, which appears to work...
=IF(MID(A1,4, 1)=" ",A1,REPLACE(A1,5,0," "))