Trying to extract the email from a column in an excel sheet using the following formula:
=TRIM(MID(SUBSTITUTE(" "&$A1&" "," ",REPT(" ",40)),
FIND(REPT("#",COLUMNS($A1:A1)),SUBSTITUTE
(SUBSTITUTE(" "&$A1&" "," ",REPT(" ",40)),"#",REPT("#",COLUMNS($A1:A1)),COLUMNS($A1:A1)))-40,80))
The formula works for the most part, however some of the records still include other text.
For example, one of the records looks like this:
**TEST** John Beasley,jbeasley#usa.com,7575551212
After using the above formula, I get the following results:
Beasley,jbeasley#usa.com,7575551212
Here's another example:
USA-USA/J Beasley/jbeasley#usa.com/757-555-1212
Results after using formula:
Beasley/jbeasley#usa.com/757-555-1212
Here is an example of when the formula works (before):
**US AMA TES DATA** John Beasley, jbeasley#usa.com
Which yields the following results:
jbeasley#usa.com
So the formula works, but it also does not work.
How can I write the formula so that it extracts everything except the actual email address?
If one has it, use FILTERXML:
=FILTERXML("<t><s>"&SUBSTITUTE(SUBSTITUTE(A1,"/",","),",","</s><s>")&"</s></t>","//s[contains(.,'#')]")
FILTERXML was introduced in Excel 2013 and only on PC not Mac.
If does not have FILTERXML then we can use:
=TRIM(MID(SUBSTITUTE(SUBSTITUTE(A1,"/",","),",",REPT(" ",999)),FIND("#",SUBSTITUTE(SUBSTITUTE(A1,"/",","),",",REPT(" ",999)))-500,999))
Related
I am trying to combine the State (NSW) and the Postal Code (2007) from cell F4 in the worksheet "Inventory", this is the text in cell F4: 310 Wattle StUltimo, 2007, NSW
What I trying to accomplish is this: NSW2007 using MID, RIGHT and FIND functions, but is giving me a headache
I tried this: =RIGHT(Inventory!F4,4) and I got so far this: NSW, what I need to get is NSW2007 so I am missing the MID (and FIND) part
thanks for your help in advance
With Office 365:
=LET(
rr,F4,
x,TRIM(TEXTSPLIT(rr,",")),
CONCAT(INDEX(x,COUNTA(x)-{0,1})))
For Older versions:
=TRIM(RIGHT(SUBSTITUTE(F4,",",REPT(" ",999)),999))&
TRIM(MID(SUBSTITUTE(F4,",",REPT(" ",999)),(LEN(F4)-LEN(SUBSTITUTE(F4,",",""))-1)*999,999))
If there is always only 2 , in the string and you want the 3rd and 2nd then we can simplify the above formula:
=LET(
rr,F4,
x,TRIM(TEXTSPLIT(rr,",")),
CONCAT(INDEX(x,{3,2})))
And
=TRIM(RIGHT(SUBSTITUTE(F4,",",REPT(" ",999)),999))&
TRIM(MID(SUBSTITUTE(F4,",",REPT(" ",999)),999,999))
I used the following Excel text formula.
Using the text in F4: "310 Wattle StUltimo, 2007, NSW"
To get NSW2007 from the text in F4 above use the following formula.
=CONCAT(TRIM(MID(F4,FIND(",",F4,FIND(",",F4,1)+1)+1,LEN(F4))),TRIM(MID(F4,FIND(",",F4,1)+1,FIND(",",F4,FIND(",",F4,1)+1)-FIND(",",F4,1)-1)))
To get NSW: =MID(F4,FIND(",",F4,FIND(",",F4,1)+1)+1,LEN(F4))
To get 2007: =MID(F4,FIND(",",F4,1)+1,FIND(",",F4,FIND(",",F4,1)+1)-FIND(",",F4,1)-1)
Then concatenate the two: concat (formula 1 above, formula 2 above).
This formula works regardless of the spaces (or no spaces at all) before and after the commas.
Hope this helps.
I have tried searching on SO, and certainly have not found solution for similar problems, may be I haven't used the right word to search.
So, Column A & Column B is my database, and Column D shows those rep names which I require as an output. I have tried using FILTER with SEARCH & ISNUMBER Function but it returns only one
=FILTER($A$2:$B$13,ISNUMBER(SEARCH($D$2:$D$4,$A$2:$A$13))=TRUE)
Images shown:
EDIT -- 07-05-2022
Try using the formula as shown in image below,
• Formula used in cell F2 --> Applicable To Excel 2021 & O365 Users
=FILTER(A2:B13,MMULT(--ISNUMBER(SEARCH(TRANSPOSE(D2:D4),A2:A13)),ROW(D2:D4)^0)=1)
• Formula can be used in cell F2 --> Applicable to All Excel Users Except Excel 2007
=IFERROR(INDEX($A$2:$B$13,
AGGREGATE(15,6,(ROW($A$2:$A$13)-ROW($A$2)+1)/
ISNUMBER(SEARCH(TRANSPOSE($D$2:$D$4),$A$2:$A$13)),
ROW($A1)),{1,2}),"")
And Fill Down!
Two more alternatives,
=LET(list,A2:B13,
p,A2:A13,
q,D2:D4,
x,--BYROW(p,
LAMBDA(a,(SUM(COUNTIF(a,"*"&q&"*"))>0))),
FILTER(list,x=1))
=LET(list,A2:B13,
p,A2:A13,
q,D2:D4,
x,MAP(p,LAMBDA(a,IF(SUM(COUNTIF(a,"*"&q&"*"))>0,a,""))),
FILTER(list,x<>""))
I have an excel list of school courses that needs to be transposed/merged, the data looks like this
I want it to look like this
Is this possible without VBA?
With Office 365 we can use UNIQUE to get a list of unique Row Labels:
=UNIQUE(A2:A9)
With 2019 one would have to get the Unique list with:
=IFERROR(INDEX(A:A,AGGREGATE(15,7,ROW($A$2:$A$9)/(COUNTIF($E$1:E1,$A$2:$A$9)=0),1)),"")
Then use TEXTJOIN to do the concatenation:
=E2&" " &TEXTJOIN(", ",TRUE,FILTER(B:B,A:A=E2,""))
With 2016 use the formula for the unique list from 2019 and then use the method here: Outputting multiple VLookup values in Excel
To use a helper column then use:
=E2&" "&VLOOKUP(E2,A:C,3,FALSE)
to return the desired value:
With Excel 365. D2:
=INDEX(UNIQUE(A$2:A$8),ROW(A1))&" "&TEXTJOIN(", ",,FILTER(B:B,A:A=INDEX(UNIQUE(A$2:A$8),ROW(A1))))
or older version: Format Column A using this format text. E2:
=D2&SUBSTITUTE(PHONETIC(OFFSET(A$1,MATCH(D2,A:A,)-1,,COUNTIF(A:A,D2),2)),D2," ")
English is not my native language; please excuse typing errors.This is for your reference only.
I am attempting to make Excel generate a 6-character password string, exactly like TeamViewer (3 letters, 3 numbers). Is there a function I might be unaware of?
I have tried =CHOOSE(RANDBETWEEN(1,2),CHAR(RANDBETWEEN(0,9)),CHAR(RANDBETWEEN(97,122)))&CHOOSE(RANDBETWEEN(1,2),CHAR(RANDBETWEEN(0,9)),CHAR(RANDBETWEEN(97,122)))&CHOOSE(RANDBETWEEN(1,2),CHAR(RANDBETWEEN(0,9)),CHAR(RANDBETWEEN(97,122)))&CHOOSE(RANDBETWEEN(1,2),CHAR(RANDBETWEEN(0,9)),CHAR(RANDBETWEEN(97,122)))&CHOOSE(RANDBETWEEN(1,2),CHAR(RANDBETWEEN(0,9)),CHAR(RANDBETWEEN(97,122)))&CHOOSE(RANDBETWEEN(1,2),CHAR(RANDBETWEEN(0,9)),CHAR(RANDBETWEEN(97,122))), and here's an example of one of the results: ckjfs.
Please see above for the Formula.
The expected result is something like: aaa111, or 1aaa11. I don't want the Formula to allow something like 11aaaa, aaaaaa, or 1234aa.
Here is an option for you to consider:
Formula in A2:
=RANDBETWEEN(1,6)
Formula in B2:
=CHAR(RANDBETWEEN(IF(OR(RANK.EQ(A2,$A$2:$A$7)+COUNTIF($A$2:A2,A2)-1={1,2,3}),48,97),IF(OR(RANK.EQ(A2,$A$2:$A$7)+COUNTIF($A$2:A2,A2)-1={1,2,3}),57,122)))
Drag down.....
Formula in D2:
Excel 2016 with CONCAT:
=CONCAT(C2:C7)
Lower versions without CONCAT:
=C2&C3&C4&C5&C6&C7
I can offer this rather long array formula:
=ArrayFormula(TEXTJOIN("",TRUE,IF(MID(TEXT(DEC2BIN(INDEX({7,11,13,14,19,21,22,25,26,28,35,37,38,41,42,44,49,50,52,56},RANDBETWEEN(1,20))),"000000"),{1,2,3,4,5,6},1)="0",
CHAR(CHOOSE({1,2,3,4,5,6},RANDBETWEEN(48,57),RANDBETWEEN(48,57),RANDBETWEEN(48,57),RANDBETWEEN(48,57),RANDBETWEEN(48,57),RANDBETWEEN(48,57))),
CHAR(CHOOSE({1,2,3,4,5,6},RANDBETWEEN(97,122),RANDBETWEEN(97,122),RANDBETWEEN(97,122),RANDBETWEEN(97,122),RANDBETWEEN(97,122),RANDBETWEEN(97,122))))))
I had to test it in Google Sheets because I only have an old version of Excel without the array concatenation features - it should work in later versions of Excel if you remove the ArrayFormula wrapper and enter it with Ctrl-Shift-Enter.
The idea is that there are only 20 ways of selecting 3 items (letters) out of 6 (letters and numbers) so choose one of them in binary (e.g. 010101) and generate letters where there are 1's and numbers where there are 0's.
EDIT
Confirmed working through Excel 2019, confirmed through CtrlShiftEnter:
I Have some address from which I need to extract phone number along with its city code.
Here is the column
A
T.C-29-877 (2), CPRA 0124-414210 mob:8578451021
T-Win Park,Westside 211-1421522 fgas-14201
Whitefield, rose bunglow 01221-2102125
Q-Part,bilmore,521-145212 abc#gmail.com
Here I want to extract
0124-414210
211-1421522
01221-2102125
521-145212
I tried with seperating with the delim - but since there can be multiple - in a text so it didn't worked for me.
Is there any which can be used to extract these values?
Any help would be appreciated.
Thanks
Domnick
Assuming the data is in cell A1 try following array formula which needs to be committed by pressing CTRL+SHIFT+ENTER. And then copy down.
=TRIM(MID(SUBSTITUTE(TRIM(SUBSTITUTE(A1,",",REPT(" ",199)))," ",REPT(" ",199)),SEARCH(MAX(IFERROR(-(MID(A1,ROW($A$1:$A$256),COLUMN($A$1:$IV$1)))+0,0)),SUBSTITUTE(TRIM(SUBSTITUTE(A1,",",REPT(" ",199)))," ",REPT(" ",199)),1)-99,199))
If applied correctly Excel will wrap formula with braces.