I'm trying to substring a date range,
Ex. 1/17/16-1/18/17 in Cell A1 to
1/17/16 in cell B1 and 1/18/17 to Cell B2
I have:
=LEFT(A1, FIND("-",A1)-1) Expecting 1/17/16
=RIGHT(A1, FIND("-",A1)+1) Expecting 1/18/17
But I get:
=LEFT(A1, FIND("-",A1)-1) results 1/17/16
=RIGHT(A1, FIND("-",A1)+1) Results 6-1/18/17
But for certain date ranges,
1/1/17-12/31/19 which is in A2
I get 1/1/17 in B2 and 12/31/19 in C2
The code is exactly same, except for the cell A2...
Can someone explain why this is happening?
In certain cases, my RIGHT brings back results like
17-5/28/17
as well...
Thanks in advance
=RIGHT(A1, LEN(A1)-FIND("-",A1))
Second parameter is [num_chars], so correct methodology is subtract LENGTH from POSITION OF '-'
What you're doing is providing the POSITION as a length.
Using Right can be painstaking. I prefer using Mid instead.
=LEFT(A1, FIND("-",A1)-1)
=MID(A1, (FIND("-",A1) +1), LEN(A1)-1)
=LEFT(A2, FIND("-",A2)-1)
=MID(A2, (FIND("-",A2) +1), LEN(A2)-1)
Related
Does anyone knows any formula to extract the number with separation (dot, comma) from cell A1 to cell B1?
Example, I want to extract 2,590.00 from cell A1 which has the following value:
[sum: 2,590.00]
I got the formula below that works nice, however is just getting all numbers e.g. 259000
{=TEXTJOIN("",TRUE,IFERROR((MID(A1,ROW(INDIRECT("1:"&LEN(A1))),1)*1),""))}
I appreciate every support
Under O365 you can try the following in cell B1 which is a very concise approach:
=TEXTAFTER(TEXTBEFORE(A1,"]"), "sum: ")
Here is the output:
For excel-2019, similar idea but using SUBSTITUTE instead to remove the prefix ([sum: ) and the suffix (]):
=SUBSTITUTE(SUBSTITUTE(A1,"[sum: ",""),"]","")
You can use a formula like as below:
• Formula used in cell B1
=MAX(IFERROR(--MID(SUBSTITUTE(A1,"]",""),ROW($ZZ1:INDEX($ZZ:$ZZ,LEN(A1))),LEN(A1)),0))
• With OFFICE 365, you can try this in cell C1
=--INDEX(TEXTSPLIT(A1,{":","[","]"},,1),,2)
• Formula used in cell D1
=SUBSTITUTE(TEXTAFTER(A1," "),"]","")*1
I have this Image Path on Cell A1:
E:\Test\Coll\01\Red\Example\Untitled-1.jpg
I want cells B2 to whatever it takes (in my case H2) to show the Nth substring between the separator "\", meaning:
I know the Data to Columns does the exact same thing, but i need it to be dynamic.
Any ideas please?
Formula for B2
=TRIM(MID(SUBSTITUTE($A2,"\",REPT(" ",100)),(B$1-1)*100+1,100))
Copy accross as far as needed
Excel Problem.
Let's say I have 2 cells.
A1: HE11294419-12
A2 11296581
I would like to extract the number after the dash found in A1, in another cell.
In case of A2 - the cell should say just "1".
So the result should be
B1: 12
B2: 1
Assumptions:
Always just one dash in string
In case no dash, extract the last number of string
Try in B1:
=IFERROR(MID(A1,SEARCH("-",A1)+1,LEN(A1)),RIGHT(A1,1))
Drag down.
In case the second assumption is wrong, and it always needs to be one just change ..RIGHT(A1,1) to ..1
You can try below formula. It will return first numbers after - if there are multiple - in cell.
=IF(ISERROR(SEARCH("-",A1)),1,TRIM(MID(SUBSTITUTE(A1,"-",REPT(" ",100)),100,100)))
I would like to return the characters after "OR XXXXXXXXXXXX" in the reference cell. Rather than using a RIGHT function, I think there is an way to set up an way with "LEN" functions. Here is what I have found so far-
Cell A2:
=IF(
ISERR(SEARCH("LUR",C2))=FALSE,
RIGHT(B2, 10),
C3)
But this isn't work for Cell A2, A3 or so on. Is there any way I can extract only the characters after "OR" in Column B? Thanks!
You can still use RIGHT(), but you make the second parameter based on the LEN() and Find() function:
=RIGHT(B2, LEN(B2) - FIND("OR", B2, 1)-1)
FIND() returns the starting position of the characters "OR" in B2. Substracting that from the length minus 1 more gets us to the right number of characters for the second parameter.
Following is the which I am trying :
Let this number 6,123,456.33 in Cell A1,
Then in Cell B1 use this formula =TEXT(A1,"#,###,###.##"), will give you 6,123,456.33.
Then in Cell C1 use this formula = SUBSTITUTE(B1,",",".") ,will give you 6.123.456.33
Then in Cell D1 use this formula =","&RIGHT(H12,2), will give you ,33.
Then again come to Cell C1 Do text to columns or other options to remove the last digits with decimals and then concatenate result with Cell D1 shows the last three digits.
This tip will ends up in 6.123.456,33
But Problem is in point no. 5.
How should I remove .33 from cell C1?
TRUNC is not working on C1.
Any Suggestions ?
Seems like you don't mind having the result as text (and I can't seem to find a way to custom format it...) and as such, you can use the formula:
=SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(TEXT(A1,"#,###.00"),",","#"),".",","),"#",".")
There's a triple substitution, one to remove , for # (a dummy character), second to change . to ,, then last from the dummy # to ..
If A1 is always a 7 digit number with 2 decimals then you could use TEXT function like this:
=TEXT(A1*100,"0\.000\.000\,00")