Replace Last 2 Digits - excel

I would like to create a way to search through column "B" and replace the last two digits of values listed.
For example,
I'd like to have,
502040155 replaced to 5020400,
403041055 to 4030400,
603054055 to 6040500,
etc.
I'm assuming a LEFT or RIGHT formula is needed? VBA or formula works fine.a

I'm going to assume that your last example was a typo. Try,
=FLOOR(A2/100, 100)

Related

Divide text in the column into two columns (text and numbers) - Google sheet or Excel

I have a document in google sheets and the column consists of the name and version, like NLog.Config.4.3.0, NLog.Config.4.4.9 and so on.
See the image below for other examples.
I need to divide this into two columns - name and version, but I'm not familiar with regular expressions so close that I can get this info.
I can use excel and then import it to the Google doc, it doesn't matter for me how to do that.
enter image description here
You can try something like this:
Suppose you have your string in A1, then in B1 you can enter this:
=LEFT(A1,LEN(A1)-MIN(SEARCH({0,1,2,3,4,5,6,7,8,9},A1&"0123456789")))
and in C1 this:
=RIGHT(A1,LEN(A1)-MIN(SEARCH({0,1,2,3,4,5,6,7,8,9},A1&"0123456789"))+1)
you may need to do some adjustments if there are cases without numbers as it will produce an error, for example you can round it with an Iferror like this:
=IFERROR(LEFT(A1,LEN(A1)-MIN(SEARCH({0,1,2,3,4,5,6,7,8,9},A1&"0123456789"))),A1)
Note: A1&"0123456789" is a 'trick' to avoid the search to return error, as the search is looking for all the numbers in the array; we just need the position of the first one, thus the MIN().
Supposing that your raw data were in A2:A, place this in B2:
=ArrayFormula(IFERROR(REGEXEXTRACT(A2:A,"(\D+)\.(.+)"),A2:A))
The regular expression reads "Extract any number of non-digits up to but not including a period as group one, and everything remaining into group two." (In other words, "As soon as you run into a digit after a period, start group two.")
The IFERROR clause means, "If this pattern can't be found, just return the original cell data."
Assuming your content is in column A (Google Sheets), try this arrayformula in any cell other than column A:
=arrayformula(iferror(split(REGEXREPLACE($A:$A,"(\.)(\d+.+$)",char(6655)&"$2"),char(6655)),))
There are two regex groups denoted in ():
(\.) and (\d+.+$).
The first group looks for a dot . - it's escaped using \. The second group looks for a number (0-9) \d, one or more occurrences + then ending with $ one or more + of any character ..
The replacement is char(6655) (wouldn't usually be found in your dataset), and the contents of group two $2.
Then the split function divides the text into two columns by the char(6655) character.
iferror returns nothing if nothing is split.
The arrayformula works down the sheet.

excel text to column delimiter starting from end of the row

I have strings in a column that look like this
/name/safsdf/231232/asesa/filename.mp4
/ds2/sasdsfsdf/2fd32/a234sa/filenameb.mp4
...
...
so text to column works great i can easily make a column that has just the filenames without the folders.
My problem is its inconsistent.
so some rows have more or less than 5 / which screws up the column.
For example:
/name/safsdf/231232/asesa/filename.mp4
/ds2/sasdsfsdf/2fd32/a234sa/filenameb.mp4
/ds3/123/12321/123/123/filenamec.ts
...
will result in the last column being:
filename.mp4
filenameb.mp4
123
I'm looking for the result to be:
filename.mp4
filenameb.mp4
filenamec.ts
Is there a way to do text to colum in reverse where it starts looking for delimiters at the end of the row?
This will give me a list of proper filenames
You already have an answer. Here is one more approach:
=TRIM(RIGHT(SUBSTITUTE(A1,"/",REPT(" ",99)),99))
What you want is a reverse string search to grab everything to the right of the last "/".
The formula (assume one of your strings is in A1) would be
=IF(ISERROR(FIND("/",A1)),A1,RIGHT(A1,LEN(A1)-FIND("~",SUBSTITUTE(A1,"/","~",LEN(A1)-LEN(SUBSTITUTE(A1,"/",""))))))
Take a look at this answer and this site for an explanation of why this works.
Take a copy and Replace */ with nothing.

Excel Formula finding numbers in column?

I have a column filled with numbers. Some rows have more than one number and are separated by and underscore '_'. I am trying to create a formula that will check to make sure all numbers in a range - say 1 through 300 are in the column. But, everything I come up with is finding the number even if it is in another one. For example, I am searching for 5 which I know is missing, but the row with 251 matches for the 5.
A sample section of the column:
20_21_22_23_30_130_131_185
20_21_22_23_157_185_233_234_245_246
24_40
24_40_41
24_40_343
28_76
28_254_255
30_44_130_131_226_342
30_76_145_193_224
30_130_131_185_226_245_246_317
31_32_33_35_36_43_44_45
31_32_33_35_36_126_127_128_130_131_187_226
I have a couple hundred rows and need to make sure I have all number listed.
Any suggestions would be helpful.
Thanks!
change your formula to instead of looking for number in string to look for "number" as this is your natural delimiter. or if you get your feed your numbers from any other particular column, let say from B2 onwards, change it in formula to "_" & B2 & "_"
EDIT
as pointed out, this solution will miss the numbers if they are they appear first in the cell. two possibilities there, please bear in mind i am not sure on exact formula you use, and the volumne of cells you go through, one option is to feed in the column with preceding "_" and enter formula as array, but this will somewhat slow down the calculation, another solution is to add a formula next to the original range which will be populate with a formula ="_"&B2and populated down and do the search from this column instead

How do I split/parse a string around the first number in Excel

I have a string in column A that is a mixture of letters and numbers. I want to split the string in half before the first number that shows up such that "abc123" becomes "abc" in column B and "123" in column C.
If there's any sort of pattern, e.g. always 3 letters.....or only 3 or 4 letters, for example then you can achieve more easily but for any number of letters (assuming that numbers always follow letters) you can use this formula in B2 (which is simpler than the suggested formula in topcat3's link, I think)
=LEFT(A2,MIN(FIND({1,2,3,4,5,6,7,8,9,0},A2&1234567890))-1)
and then this formula in C2
=REPLACE(A2,1,LEN(B2),"")
Note that this last formula returns the number part as a text value - if you want it to be numeric add +0 to end of formula (but you will lose any leading zeroes)
Just wanted to contribute a slight variation on Barry's formulas. Slightly easier to understand in my opinion but a little bit more difficult to use:
You can use this array formula to find the starting position + 1 of the first number:
{=MIN(IFERROR(FIND({1,2,3,4,5,6,7,8,9,0},A2),""))}
entered with ctrl+alt+enter to make it an array formula.
Then you can use that number to split the first part off of the string:
=LEFT(A2,B2-1)
And then you can use REPLACE() to get rid of the first part(the letters) off of the string.
=REPLACE(A2,1,LEN(C2),"")
You should accept Barry's answer and not this one because his is easier to use and more concise. But just wanted to add a variation in my quest to understand how Barry's formula worked.

How can I get Excel to copy every nth cell from one sheet onto another?

My data starts in C9 and I want to reference every 18th row. For example (the referenced sheet is named Summer):
=+Summer!C9
=+Summer!C27
=+Summer!C45
How can I get excel to recognize this pattern so I don't have to type it over and over?
Thanks!
Not pretty, but you can do something like this:
=indirect("Summer!C" & (Row()*18-9))
Basically use the current row as a multiplier, and construct the formula.
Edit:
Indirect is a function that allows you to use a cell reference you have constructed from a string. So we're actually trying to contruct:
=indirect("Summer!C9")
which evaluates the same as your original
=Summer!C9
So all we need to do is compute the number 9 from whatever we have handy. To find the right math to calculate the number you want, lets test this simpler version:
=(Row()-n+1)*18)-9)
This should give you a number. Replace n with the row number where you first formula appears. So if your first formula was actually on row 25, you'd instead use:
=(Row()-25+1)*18)-9)
Once you are sure the number is correct, then just tack on the
=indirect("Summer!C" &
portion and you should be good to go. Note I've also assumed that each formula is in the row below the previous one. If that's not the case, then you'd have to make other adjustments. But its all just math.
if you just need numbers mixed in with words above and below you could do a filter and then a select visible cells only and paste into a new sheet

Resources