Google Sheets Formula Help

Jewells0905

New Member
Joined
Mar 10, 2024
Messages
42
Office Version
  1. 365
Platform
  1. Windows
  2. MacOS
I am trying to create an interactive sheet, in Cell G2 the user will enter a person's last name.
  • cell H2 will be used look up the first occurrence of this last name in column A, find the gender of the person, and display it. The result should be proper-cased, i.e. either "Male" or "Female".
  • In cell I2 I am trying to to lookup the first occurrence of the last name in column A, find whether the person survived, and display "Yes" if that person did survive and "No" otherwise.

Full namePClassAgeGenderSurvivedLast nameGenderSurvived?
Allen, Miss Elisabeth Walton1st29female1
Allison, Miss Helen Loraine1st2female0
Allison, Mr Hudson Joshua Creighton1st30male0
Allison, Mrs Hudson JC (Bessie Waldo Daniels)1st25female0

I am currently using formula =INDEX(D2:D1314,(MATCH(G2,A2:A1314))) in cell G2, however it is not giving the correct name ex if I search for Alisson, it will pull for 1, which is Allen, not the 1st occurrence of Allison. I believe that I need to use a wildcard, ex G2*, however when I try this as either G2*, or "G2*" it gives an error, stating not found as it's looking for "g2" instead of the last name followed by the first name. Maybe I need to use the ampersand, I'm not sure.

In cell H2, I am currently using =INDEX(D2:D1314,(MATCH(G2,A2:A1314))), but again it is not pulling the correct info as it's going from the 1 position not the 2 position.
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
H2 Formula:
Excel Formula:
=PROPER(XLOOKUP("*" & G2 & "*",$A$2:$A$5,$D$2:$D$5,"not found",2,1))

I2 Formula:
Excel Formula:
=IF(XLOOKUP("*" & G2 & "*",$A$2:A5,$E$2:$E$5,"not found",2,1),"Yes","No")
 
Upvote 0
I wonder if the first problem is imply the type of MATCH you're using. Try
Excel Formula:
MATCH(G2,A2:A1314, 0)
which would require an exact match in your G2 formula; the '0' defines the type of search.
 
Upvote 0
Looking at this further, you shouldn't be using a wildcard match because it will also return the person with the first name or middle that matches in cell G2. I'd recommend using a helper column to extract the last name, and then look up the exact match.

Book1
ABCDEFGHIJ
1Full nameLastNamePClassAgeGenderSurvivedLast nameGenderSurvived?
2Allen, Miss Elisabeth WaltonAllen1st29female1AllenFemaleYes
3Allison, Miss Helen LoraineAllison1st2female0
4Allison, Mr Hudson Joshua CreightonAllison1st30male0
5Allison, Mrs Hudson JC (Bessie Waldo Daniels)Allison1st25female0
Sheet6
Cell Formulas
RangeFormula
I2I2=PROPER(XLOOKUP(H2,$B$2:$B$5,$E$2:$E$5))
J2J2=IF(XLOOKUP(H2,$B$2:$B$5,$F$2:$F$5),"Yes","No")
B2:B5B2=LEFT(A2, FIND(",", A2) - 1)
 
Upvote 0
Solution
I wonder if the first problem is imply the type of MATCH you're using. Try
Excel Formula:
MATCH(G2,A2:A1314, 0)
which would require an exact match in your G2 formula; the '0' defines the type of search.
I had thought that as well, however when I add the 0 in there, it gives me a #N/A error- Did not find value 'Riordan' in MATCH evaluation. I think that might have been because I needed to do some sort of wildcard for the search cell G2, but I wasn't able to figure out how to make that work
 
Upvote 0

Forum statistics

Threads
1,224,820
Messages
6,181,154
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top