Having some issues with my formula and I'm hoping to find some help here.
This is my formula:
=IFERROR(REPLACE(F7, FIND("BOB",A2), 13, "Other"),A2)
I have 3 names in my data (Column B):
Bob
Sarah
Lee
What I want to do is find "Bob"'s name and in column C return it as "Other", and I want Sarah to return as Sarah and Lee to return as Lee.
With my formula, currently it's returning everyone's name as "Open" and I'm not quite sure why.
Any recommendations?
Use:
=IF(ISNUMBER(FIND("Bob",A2)),"Other",A2)
one thing to remember FIND is an exact match while SEARCH does not care about case.
So if Bob can be BOB and Bob then you may want to use SEARCH
=IF(ISNUMBER(SEARCH("Bob",A2)),"Other",A2)
An alternative to #ScottCraner's answer.
It is unclear if you want only "Bob" to result in "Other", or if you want anything other than "Sarah" or "Lee" to result in "Other".
If you want the latter, you can use this array formula:
= IF(MAX(IFERROR(FIND({"Sarah","Lee"},A2),0))=0,"Other",A2)
Note this is an array formula so you must press Ctrl+Shift+Enter on your keyboard after typing the formula rather than just Enter.
Related
I have quiz question like
what is the capital of india
a,delhi
b,bombay
c,chennai
d,bengaluru
answer in a different column as A
I what to put a column which will check the answer a and get the option in the
result field
If I use this function =INDEX(B2:E2,MATCH(F2,$B$1:$E$1,0)) the first and second line is getting answer not sure why the lines like the third are showing NA in result :( #basic
Hey #basic This is the formula
formula I used
Use INDEX/MATCH:
=INDEX(B2:E2,MATCH(F2,$B$1:$E$1,0))
Perhaps you like to use HLOOKUP for this.
=HLOOKUP(F2, B1:E2, 2, FALSE)
The function looks for a match in the first row of the range specified - here B1:E2 - and returns the value in the 2nd row, as specified by the number 2 in the formula.
This formula will throw an error if no match is found, perhaps because the user entered "Y". You can use this for your purposes by embedding the formula in an IFERROR function as is demonstrated below.
=IFERROR(HLOOKUP(F2, B1:E2, 2, FALSE),"Select a valid choice")
I need a little help: I have to cross match Database A user names(firstname lastname) with Database B where there are some extra characters and the order is last name firstname), so the normal vlookup does not find exact match. I tried the following: I used text to column from the Database A, to have two separate column, then I tried to find the name from Database B
=IF(IF(ISNUMBER(SEARCH(A1,C1)),ISNUMBER(SEARCH(B1,C1))),"yes","no")
This show correct result when the name is in the same line
A1 Tom
B1 John
C1 John dr tom -
The results is true(yes), but in case:
A1 Tom B1 Jon C2 John dr tom - the result are false(No)
I need to same at Database A which is a appearing at Database 2. So I need to find the duplicated items.
Can you help me out how to correctly find what I am looking for?
=VLOOKUP(""&B1&"" &""&A1&"",F:F, 1,FALSE) This was the answer, I managed to figure out.
I am looking for a way to find the match in Column A to B and highlight. I tried many excel formulas in the forum but unlucky in getting it work.
For eg..
**ColumnA**
John23
Peter
Nick5
Kevin4
T12345
ColumnB
John23 is outside the yard
Kevin4 is the famous guy
ABC is with Nick5
Who is the person at the door. is it Peter?
R345 Qrtfjd T12345
Kevin is not the match
Only Kevin4 is the match
John is not the match
=IFERROR(INDEX(A:A,AGGREGATE(15,6,ROW($A$1:INDEX(A:A,MATCH("zzz",A:A)))/(ISNUMBER(SEARCH($A$1:INDEX(A:A,MATCH("zzz",A:A)),B1))),1)),"")
Say I have the following text string in one single Excel cell:
John John John Mary Mary
I want to create a formula (so no menu functions or VBA, please) that would give me, on another cell
John Mary
How can I do this?
What I've tried so far was search the internet and SO about the issue and all I could find were solutions involving Excel's built-in duplicate removal or something involving countif and the replacement of duplicates for "". I've also taken a look at the list of Excel functions, especially those from the "Text" category, but couldn't find anything interesting, that could be done on one cell.
The answer is here: https://www.extendoffice.com/documents/excel/2133-excel-remove-duplicate-characters-in-string.html
Function RemoveDupes2(txt As String, Optional delim As String = " ") As String
Dim x
'Updateby20140924
With CreateObject("Scripting.Dictionary")
.CompareMode = vbTextCompare
For Each x In Split(txt, delim)
If Trim(x) <> "" And Not .exists(Trim(x)) Then .Add Trim(x), Nothing
Next
If .Count > 0 Then RemoveDupes2 = Join(.keys, delim)
End With
End Function
Put the code above in a module
Use =RemoveDupes2(A2,",")
A2 contains repeated text separated by ,
You may change the delimiter
Assuming you'll never have more than two distinct names in a cell, this should work:
=MID(A1&" ",1,FIND(" ",A1&" "))&
MID(SUBSTITUTE(A1&" ",MID(A1&" ",1,FIND(" ",A1&" ")),"")&" ",1,
FIND(" ",SUBSTITUTE(A1&" ",MID(A1&" ",1,FIND(" ",A1&" "))&" ","")))
It will show John Mary for all of these:
John John John Mary Mary
John Mary
John Mary John Mary
John Mary Mary
John John Mary
It will show John for all of these:
John
John John
John John John
And it will show nothing if A1 is blank.
As I wrote, it is trivial to solve with VBA. If you cannot use VBA, one method is to use helper columns.
Assume: Your string is in A1
Enter the following formulas:
C1: =IFERROR(INDEX(TRIM(MID(SUBSTITUTE($A$1," ",REPT(" ",99)),(ROW(INDIRECT("1:" & LEN($A$1)-LEN(SUBSTITUTE($A$1," ",""))+1))-1)*99+((ROW(INDIRECT("1:" & LEN($A$1)-LEN(SUBSTITUTE($A$1," ",""))+1))=1)),99)),ROWS($1:1),1),"")
D1: =IF(COUNTIF(C1:$C$5,C1)=1,C1,"")
Select C1 and D1 and fill down until you start getting blanks
E1: =D1
E2: =TRIM(CONCATENATE(D2," ",E1))
Select E2 and fill down.
The contents of the last cell filled in column E will be your result.
If you want to have a cell which automatically returns the contents of the last cell in column E range, you can use a formula like:
=LOOKUP(REPT("z",99),$E$1:$E$100)
Without a formula: Text to Columns with space as the delimiter, transpose the output, apply Remove Duplicates to each of the columns individually, then transpose the result.
Found a solution that might work if you are also the one making the list.
when you make the list if you are doing it by combining the cell above with the current line, you can check to see if the value is already in the above cell using the following code:
if(iserror(find(value_to_be_added,previous_concatenation)),
previous_concatenation&" "&value_to_be_added,previous_concatenation)
Did you try the textjoin function? (available in Excel 2016, not sure about previous versions). Was just looking for something similar and this seems to do the job for me on a column where I have multiple values more than once.
=TEXTJOIN(delimiter;ignore_empty;text)
define delimiter in any way you need it
ignore empty can be true or false, depending on what serves your needs
text would be your array of values - using the unique function within here (see example below) will filter out any multiples of any string (I am using it for numbers and it works)
Example:
=TEXTJOIN(" ";TRUE;UNIQUE($A$1:$A$16))
Guess this might be Excel's equivalent to google sheets' join function. Textjoin comes up if you type in =join - I took the formula provided in user11308575's post above but removed the parantheses and its content, then went from there.
Hope this helps (even though the thread is already old) ;)
If one has access to TEXTJOIN one could use:
=TEXTJOIN(" ",,FILTERXML("<t><s>"&SUBSTITUTE(A1," ","</s><s>")&"</s></t>","//s[not(preceding::*=.)]"))
I found the answer below in this thread https://superuser.com/questions/643909/remove-duplicate-entries-in-one-cell
=join(" ",unique(transpose(split(A1," "))))
I have multiple spreadsheets in a workbook and I would like the following in basic English talk:
IF worksheet1(cell)A3, appears in 'worksheet2' column B - count how many times it appears in column b 'worksheet 2'
So in other words - Lets say A3 = BOB smith - in work sheet 1
and appears 4 times in worksheet 2 - I want the formula to count the fact that A3 'Bob smith' is in worksheet 2 4 times, and come back and tell me 4.
I have attempted to do separate calculations - with use of Vlookups - then in another cell to count/do if statement
for example
=COUNTIF(VLOOKUP(A9,'To retire'!J:J,9,1))
=IF(J228=O233, 'worksheet2'!F440,0)
=VLOOKUP(A3,'worksheet2'!A:A,1,1)
Help would be very much appreciated, I am very stuck - I am unsure if I am looking into this too deeply or not enough! Thank you in advance
This is trivial when you use SUMPRODUCT. Por ejemplo:
=SUMPRODUCT((worksheet2!A:A=A3)*1)
You could put the above formula in cell B3, where A3 is the name you want to find in worksheet2.
=COUNTIF() Is the function you are looking for
In a column adjacent to Worksheet1 column A:
=countif(worksheet2!B:B,worksheet1!A3)
This will search worksheet 2 ALL of column B for whatever you have in cell A3
See the MS Office reference for =COUNTIF(range,criteria) here!
You can combine this all into one formula, but you need to use a regular IF first to find out if the VLOOKUP came back with something, then use your COUNTIF if it did.
=IF(ISERROR(VLOOKUP(B1,Sheet2!A1:A9,1,FALSE)),"Not there",COUNTIF(Sheet2!A1:A9,B1))
In this case, Sheet2-A1:A9 is the range I was searching, and Sheet1-B1 had the value I was looking for ("To retire" in your case).
Try this:
=IF(NOT(ISERROR(MATCH(A3,worksheet2!A:A,0))),COUNTIF(worksheet2!A:A,A3),"No Match Found")
If your are referring to two worksheets please use this formula
=COUNTIF(Worksheet2!$A$1:$A$50,Worksheet1cellA1)
In case referring to to more than two worksheets please use this formula
=COUNTIF(Worksheet2!$A$1:$A$50,Worksheet1cellA1)+=COUNTIF
(Worksheet3!$A$1:$A$50,Worksheet1cellA1)+=
COUNTIF(Worksheet4!$A$1:$A$50,Worksheet1cellA1)