How to return a value from a range if cell contains that value

James Cooper

I have a list of Names (First and Surname) in A:A. I also have a range called 'Surnames'. How can I apply a formula so that B:B returns the surname only of A:A if that name is found in the range 'Surnames'.

I other words, I want to check a cell in A1, if part of this cell value contains a name listed in my range of surnames, return the surname that A1 include in B1.

I hope this makes sense, and thank you in advanced :)

barry houdini

Try this formula in B1 copied down

=IF(COUNTIF(Surnames,REPLACE(A1,1,FIND(" ",A1),"")),REPLACE(A1,1,FIND(" ",A1),""),"")

The REPLACE/FIND part extracts the surname from A1 (assuming A1 is in the form <firstname><space><surname>) and then the formula uses COUNTIF to count that surname in your named range. If it's there the surname is returned, otherwise you get a blank.

There may be shorter ways but this should ensure a match with the surname, otherwise you might get "false positives" if part of the surname (or the firstname) might match a surname

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How to return a value from a range if cell contains that value

From Dev

Return all the cell whose next one contains a value range

From Dev

Return all the cell whose next one contains a value range

From Dev

How to delete column from range if cell contains specific value in VBA/Excel

From Dev

How to return column value in another sheet if a cell contains "Pick up"

From Dev

How can I write an excel formula to return a value from a range based on the contents of a cell?

From Dev

Excel how to look for value in table and return value from another cell

From Dev

Return value of last populated cell in variable range

From Dev

How to return 0 if cell value is 0 or value from different cell if cell is empty

From Dev

Exclude cell value from rank range based on value in another cell

From Dev

Return True or False if value in cell matches value in range of cells

From Dev

Want to return blank cell if any cell in the range has a numeric value

From Dev

Excel: How to have an IF function return the value of the cell from another sheet

From Dev

Read range value from a STRING cell

From Dev

get cell value from a range defined with variables

From Dev

Select a cell value from a range based on criteria

From Dev

Copy the value from a cell in a worksheet into a range of cells

From Dev

Read range value from a STRING cell

From Dev

Refer to Named Range from Cell Value in For Loop

From Dev

Excel - If a Cell contains a value from an Array, extract that value

From Dev

Determine if a Range contains a value

From Dev

How to find a cell value within the visible range

From Dev

Function will not return array when range contains only one value

From Dev

Return single cell value from Pandas DataFrame

From Dev

how to set value in 2 cell if other cell contains 'something'

From Dev

Return cell's value based on its date range in Excel

From Dev

Find all occurrences and return value of the top cell in a range

From Dev

jQuery: How to return a value outside a function that contains the 'this'?

From Dev

How to subtract adjacent cell value from a cell

Related Related

  1. 1

    How to return a value from a range if cell contains that value

  2. 2

    Return all the cell whose next one contains a value range

  3. 3

    Return all the cell whose next one contains a value range

  4. 4

    How to delete column from range if cell contains specific value in VBA/Excel

  5. 5

    How to return column value in another sheet if a cell contains "Pick up"

  6. 6

    How can I write an excel formula to return a value from a range based on the contents of a cell?

  7. 7

    Excel how to look for value in table and return value from another cell

  8. 8

    Return value of last populated cell in variable range

  9. 9

    How to return 0 if cell value is 0 or value from different cell if cell is empty

  10. 10

    Exclude cell value from rank range based on value in another cell

  11. 11

    Return True or False if value in cell matches value in range of cells

  12. 12

    Want to return blank cell if any cell in the range has a numeric value

  13. 13

    Excel: How to have an IF function return the value of the cell from another sheet

  14. 14

    Read range value from a STRING cell

  15. 15

    get cell value from a range defined with variables

  16. 16

    Select a cell value from a range based on criteria

  17. 17

    Copy the value from a cell in a worksheet into a range of cells

  18. 18

    Read range value from a STRING cell

  19. 19

    Refer to Named Range from Cell Value in For Loop

  20. 20

    Excel - If a Cell contains a value from an Array, extract that value

  21. 21

    Determine if a Range contains a value

  22. 22

    How to find a cell value within the visible range

  23. 23

    Function will not return array when range contains only one value

  24. 24

    Return single cell value from Pandas DataFrame

  25. 25

    how to set value in 2 cell if other cell contains 'something'

  26. 26

    Return cell's value based on its date range in Excel

  27. 27

    Find all occurrences and return value of the top cell in a range

  28. 28

    jQuery: How to return a value outside a function that contains the 'this'?

  29. 29

    How to subtract adjacent cell value from a cell

HotTag

Archive