Public Schedule Face-to-Face & Online Instructor-Led Training - View dates & book

excel formula return text

Forum home » Delegate support and help forum » Microsoft Excel Training and help » Excel Formula to return text when a cell contains certain text

Excel Formula to return text when a cell contains certain text

ResolvedVersion 365

Joshua has attended:
Excel Introduction course
Excel Intermediate course
Excel Advanced course

Excel Formula to return text when a cell contains certain text

Good Morning

I am trying to think of a formula to perform the function of the above.

I am trying to group US states for example if a cell contains NC,SC or GA then then the answer will appear as South East.

Any thoughts of advise?

Thank you

Josh

RE: Excel Formula to return text when a cell contains certain te

Hello Joshua,

Thank you for your question. The best formula to achieve this is using XLOOKUP.

You can write it as follows:

=XLOOKUP(B2,$E$2:$E$51,$F$2:$F:$51)

where B2 (the lookup value) holds the state code in the line item, column E (the lookup array) holds all the state codes and column F (the return array) holds all the corresponding regions.

E F
NC South East
SC South East
NY North East

I hope this helps.

Kind regards
Marius Barnard
STL

Wed 21 Aug 2024: Automatically marked as resolved.

Excel tip:

Finding your worksheets quickly

The arrows to the left of the worksheets are used to move between one sheet at a time or first / last worksheet, but if you right click on the arrow buttons it gives you all worksheets in your workbook.

View all Excel hints and tips

Connect with us:

0207 987 3777

Call for assistance

Request Callback

We will call you back

Server loaded in 0.11 secs.