I'm having a problem in Excel, where I'm trying to search an entire column for a name (not necessarily 100% identical) that is in another column.
The following table for a better explanation:
---------------------------------------
NAME CITY FATHER NAME
---------------------------------------
Saad Test New York William Jack
Jack Jacking Paris Noah Saad
Adam King Rabat William Sara
Sara Best Madrid Benjamin Adam
Briefly: I want to get the father's name by using only the name column. Is there a way to do that? (The order of the fathers’ names is incorrect, so I want to search using the name, if it is present in the father’s name, then it is the result I want)
Example: Saad test his father's name is Noah Saad (Match by Saad)
PS: I tried using LOOKUP, VLOOKUP and MATCH, but unfortunately the result is always N/A
PS 2: The data I have in Arabic is the reason why the above functions are not working?
I would use index() with match(), assuming your data starts in cell A1, like so:
=index(C1:C4,match(F1,A1:A4,0))
F1 contains the name that you look for.
Note, the classic problem is that there are extra spaces (leading or trailing) that make the names not identical.
You can trap errors as so:
=iferror(index(C1:C4,match(F1,A1:A4,0)),"Check")
You could do:
=INDEX( $C$2:$C$5, MATCH( "*" & MID( A2, 1, FIND( " ", A2 )-1), $C$2:$C$5,0) )
SolarMike - I think you have said the same, so I'm sorry if I am
stepping on your answer.
In my worksheet, B2:F2 and B8:D8 are already filled in.
I would like to find the formulas for B9:D9. For instance, B9 is 2 because we can find Lee in Lee XXXX and Lee is at the second place of B2:F2. C9 is 4 because we can find Jim in Jim XXXX and Jim is at the second place of B2:F2.
To check the relation of Lee and Lee XXXX (Jim and Jim XXXX), we could use SEARCH, left_substring (if such a function exists).
Both single formulas or array formula will be fine. Using LAMBDA function is secondary choice, because it is still in preview.
Could anyone help?
If what is needed is always the first "word":
=MATCH(LEFT(B8,FIND(" ",B8)-1),$B$2:$F$2,0)
If you want to search on any position in the string:
=AGGREGATE(15,7,(COLUMN($B$2:$F$2)-MIN(COLUMN($B$2:$F$2))+1)/(ISNUMBER(SEARCH(" "&$B$2:$F$2&" "," "&B8&" "))),1)
With FILTER instead of AGGREGATE:
=#FILTER((COLUMN($B$2:$F$2)-MIN(COLUMN($B$2:$F$2))+1),ISNUMBER(SEARCH(" "&$B$2:$F$2&" "," "&B8&" ")),"")
Context: I'm working on creating a dynamic tool in Excel to append existing ID's from our donor database onto incoming recurring gifts that will be imported.
I'm using an Array formula with multiple criteria to try and match IDs from our database based on incoming data of dubious quality (due to custom user input).
Sample Content:
By request, here are headings with a sample row below. First from one sheet, and then from the next.
WISE_TRANSACTIONS_2
Date Type Transaction Amount Description Payment Type Payment Name Account Code Email First Name Name.1.2 Last Name Address 1 Address 2 City State Zip Country
7/31/2018 23:27 Sponsorship $48.00 Sponsorship for Beneficiary XX11 Debit / MasterCard Peter K Tular IND-0019793 petetee#icloud.com Peter K Tular 123 Fake St Los Angeles Ca. 90043 US
GIFT_ID_1
First Name Name.1.2 Last Name Gift Type Nickname Constituent ID Gift ID Gift Amount Preferred Address Line 1 Preferred City Preferred State Preferred ZIP E-Mail Number Fund ID
Peter Tular Recurring Gift 81435 9777445 $48.00 123 Fake St Los Angeles California 90043 petertee#me.com Sponsorship
Problem: My formula seems to not prioritize the first IF statement in a series of nested IF statements. This first IF is based on their email since that's likely the most unique identifier available from the import.
Sorry the copied formula text is grotesque because of my weird excel formatting. Let me know if you'd like this redone in some way from my end.
Full formula - doesn't give e-mail priority, but I think it should
{=INDEX(GIFT_ID_1[#All],
MATCH(1,
(GIFT_ID_1[[#All],[Gift Amount]]=WISE_TRANSACTIONS_2[#[Transaction Amount]])*
IF((LEFT(GIFT_ID_1[[#All],[E-Mail Number]],6)=LEFT(WISE_TRANSACTIONS_2[#Email],6)),
(LEFT(GIFT_ID_1[[#All],[E-Mail Number]],6)=LEFT(WISE_TRANSACTIONS_2[#Email],6)),
(IF((GIFT_ID_1[[#All],[Last Name]]=WISE_TRANSACTIONS_2[#[Last Name]]),
(GIFT_ID_1[[#All],[Last Name]]=WISE_TRANSACTIONS_2[#[Last Name]]),
IF((LEFT(GIFT_ID_1[[#All],[First Name]],6)=LEFT(WISE_TRANSACTIONS_2[#[Last Name]],6)),
(LEFT(GIFT_ID_1[[#All],[First Name]],6)=LEFT(WISE_TRANSACTIONS_2[#[Last Name]],6)),
IF((LEFT(GIFT_ID_1[[#All],[First Name]],6)=LEFT(WISE_TRANSACTIONS_2[#[First Name]],6)),
(LEFT(GIFT_ID_1[[#All],[First Name]],6)=LEFT(WISE_TRANSACTIONS_2[#[First Name]],6)),
(GIFT_ID_1[[#All],[Nickname]]=WISE_TRANSACTIONS_2[#[First Name]]))))*
(IF((LEFT(GIFT_ID_1[[#All],[Preferred Address Line 1]],6)=LEFT(WISE_TRANSACTIONS_2[#[Address 1]],6)),
(LEFT(GIFT_ID_1[[#All],[Preferred Address Line 1]],6)=LEFT(WISE_TRANSACTIONS_2[#[Address 1]],6)),
IF((GIFT_ID_1[[#All],[Preferred ZIP]]=WISE_TRANSACTIONS_2[#Zip]),
(GIFT_ID_1[[#All],[Preferred ZIP]]=WISE_TRANSACTIONS_2[#Zip]),
(GIFT_ID_1[[#All],[Preferred City]]=WISE_TRANSACTIONS_2[#City])))))),
0),6)}
Instead it's using something less ideal, and several steps further down the line, like first name.
If I strip out the entire IF section of the formula, the email match works perfectly.
Reduced formula:
{=INDEX(GIFT_ID_1[#All],
MATCH(1,
(GIFT_ID_1[[#All],[Gift Amount]]=WISE_TRANSACTIONS_2[#[Transaction Amount]])*
(LEFT(GIFT_ID_1[[#All],[E-Mail Number]],5)=LEFT(WISE_TRANSACTIONS_2[#Email],5)),
0),6)}
What am I missing here? This is about as deep as I've dived into Excel up to now, and my first post on here ever. Any help is appreciated!
It's not perfect yet, but I've got it working for the problem cases I was looking at.
I realized the Index Match was making it's way down the Array, simply seeing who the first entry was it came across that matched anything it needed to find.
Therefore even though I was searching using
Michael Hernando, $48.00, 477 Bowter Plant Dr, Apex, NC, 35779,
hernandos#gmail.com
This (with a different last name and unrelated email)
Michael Johnson, $48.00, 555 Nebraska Ave, Apex, NC, 35779, tomatoboy#aol.com
Was found before this
Michael Hernando, $48.00, 911 Maui Ct, Maggie Valley, NC, 35688,
hernandos#gmail.com
Because I allowed a worst case scenario where only the Transaction Amount, First Name and Zip or City all matched.
Basically, I needed to tighten up my requirements. A few changes I made:
E-mail now searches everything up to the # symbol. Because there are a few e-mail row's in my array's e-mail column that are empty, I had to throw in IFERROR to deal with #N/A results.
I figured a matching street address for 8 characters is a good indicator, so I put that on par with e-mail.
Alternatively, some semblance of matching First, Last and location is the backup method.
I also made simplified use of IF conditions after realizing we're just trying to get 1's and 0's.
The formula I went with was this
{=INDEX(GIFT_ID_1[#All],
MATCH(1,
(GIFT_ID_1[[#All],[Gift Amount]]=WISE_TRANSACTIONS_2[#[Transaction Amount]]) *
IF(IFERROR((LEFT(GIFT_ID_1[[#All],[E-Mail Number]],FIND("#",GIFT_ID_1[[#All],[E-Mail Number]])-1)=LEFT(WISE_TRANSACTIONS_2[#Email],FIND("#",WISE_TRANSACTIONS_2[#Email])-1)),0) +
(LEFT(GIFT_ID_1[[#All],[Preferred Address Line 1]],8)=LEFT(WISE_TRANSACTIONS_2[#[Address 1]],8)) +
(IF(IF((GIFT_ID_1[[#All],[Last Name]]=WISE_TRANSACTIONS_2[#[Last Name]]) +
(LEFT(GIFT_ID_1[[#All],[First Name]],6)=LEFT(WISE_TRANSACTIONS_2[#[Last Name]],6))
>0,1,0) *
IF(((LEFT(GIFT_ID_1[[#All],[First Name]],6)=LEFT(WISE_TRANSACTIONS_2[#[First Name]],6)) +
(GIFT_ID_1[[#All],[Nickname]]=WISE_TRANSACTIONS_2[#[First Name]]))
>0,1,0) *
IF(((LEFT(GIFT_ID_1[[#All],[Preferred Address Line 1]],6)=LEFT(WISE_TRANSACTIONS_2[#[Address 1]],6)) +
(GIFT_ID_1[[#All],[Preferred ZIP]]=WISE_TRANSACTIONS_2[#Zip]) +
(GIFT_ID_1[[#All],[Preferred City]]=WISE_TRANSACTIONS_2[#City]))
>0,1,0)
>0,1,0))
>0,1,0),
0),6)}
I have a free text column full of contact details. I want to extract realtion ship out of the contact details. I tried different formulas, but didnt work. Even I have added a column with relationship status and tried
=INDEX(D$2:D$5,MATCH(1,IF(ISERROR(SEARCH(D$2:D$5,A2)),0,1),0),1)
but it didnt work.
For ex:
Contact Details Column:
Matthew Brown: Wife: 937268475663 (home) or 939848399384 (mobile)
Bill Benoit: Father: 7494785736784
Spouse - Matha Nocon - 948479 289374
Mrs Elaine Batty: Wife: 29474567334
Iain Beveridge020 8877 3537
Janice Waddy01482 581000 Work 07986501322 Mobile
Tony Salter (Father)Tel: 0207 583 5000
Mrs Amanda Bluff - 01507 466198
Paula Washburn[Sister] - 87362 741895 [Home]
Cliff Potter (Husband) - 0263 88472363(Work)
I want an excle formula that searches relationship from ralationship status column inside the contact details column and extract relationship (wife, husband, etc.).
Hi Kaliakanhu Panigrahi,
You use array in your formula and you forgot put it on {}.
You can do it by pressing Ctrl + Shift + Enter when you are in the formula cell.
When I did this it works fine for me.
If possible, I need help with creating excel macro which will clean some fields in my spreadsheets.
I am receiving excel spreadsheets with different amount of records. And in the following spreadsheets I need to format fields like First Name / Last Name / Job Title / City (I used excel Proper() function when I did it manually). Most important, I need also to replace Industry field with the standard values from another sheet. And: to replace State (from short values, like TX to Texas), also replace Country from us or usa or united states of america to "United States". (when I performed this manually, I used VlookUp () function).
Example:
I have spreadsheet(s), like:
Sheet 1, Data:
FName LName Email Title City ST Phone Industry Country
John sm j#hotmail.com it dallas TX 5556663344 mobile us
jess lee jess#aol.com ba ny ny 6667775656 art usa
nick Jahn nick#aol.com ba raleigh ny 444-3338888 tech us
Sheet2, State:
ST ST_Full
TX Texas
NY New York
NC North Carolina
etc. -> all US / Canada states list
Sheet 3, Industry:
Industry Industry_Correct
Mobile Telecom
Art Other
Tech Technology
etc. -> the list of all possible variations correct/incorrect industries
Sheet 4, Country:
Country
Angola
Canada
Russian Federation
United States
for the Sheet 4, I have alphabetical list of over 200 countries, and need to replace countries like "us" "Russia" to proper name from the list.
Result Sheet, (what expecting to have):
FName LName Title City ST Phone Industry Country
John Sm It Dallas Texas 555-666-3344 Telecom United States
Jess Lee Ba New York New York 666-777-5656 Other United States
Nick Jahn Ba Raleigh New York 444-333-8888 Technology United
States
email
j#hotmail.com
jess#aol.com
nick#aol.com
I was trying to record very simple macro; but I have very different spreadsheets - w. different amount of records - from 5 to 2000 or 3000 records.
Simple recorded macro only somehow cleaned FIXED amount of records.
It sounds like you have your recorded macro working properly except that it is working on a fixed amount of records. You need to make the range dynamic so your macro can see how many rows of data there are automatically. Without seeing your code, its hard to tell you how to implement this. Generally, something like this will do the trick:
Dim sht As Worksheet
Dim LastRow As Long
Set sht = ThisWorkbook.Worksheets("[sheet name]")
'Can also reference the sheet code, which is better in my opinion. Set sht = Sheet1 or whatever number your sheet is.
'This will fetch the last row for you
LastRow = sht.Cells(sht.Rows.Count, "A").End(xlUp).Row
You may find this website helpful: http://www.thespreadsheetguru.com/blog/2014/7/7/5-different-ways-to-find-the-last-row-or-last-column-using-vba
To respond to your comments:
You should implement this at the very beginning of your code. So what we are doing is 1) setting the sheet for the macro, 2) determining the last row of data in that sheet, and 3) you need to then use that last row to set a Range for the macro to work on, or at least go through your macro and replace row 1000 with LastRow. So, in addition to the code I provided, you may also have something like:
Dim myRange as Range: Set myRange = sht.Range("A2:Z" & LastRow)
Then you can simply reference myRange when you need your macro to do something in that range. Hope that helps. Instead of make a new post, you should be able to edit your original post to add some of your code if necessary.
As to your IFERROR question, its hard to say the most correct approach without more information. Generally speaking, I think its better to use if/else statements, but you can certainly just use WorksheetFunction.iferror(...) if you need to replicate the same iferror functionality that is built into Excel.