Nested LOOKUP formula with TRIM and FIND

janema

Board Regular
Joined
Nov 28, 2022
Messages
143
Office Version
  1. 365
  2. 2021
  3. 2019
  4. 2011
  5. 2010
Platform
  1. Windows
  2. Mobile
I have been trying to create a nested xlookup formula with a trim and find, but wonder if this is possible. The two formulas I am trying to combine are as follows:

=XLOOKUP(F4,'EmpExport(3.11.24)'!E:E,'EmpExport(3.11.24)'!BC:BC)
&
=TRIM(RIGHT(A2,LEN(A2)-FIND(",",A2))&" "&LEFT(A2,FIND(",",A2)-1))
The source data of that lookup formula returns the name of an employee in "Last Name, First Name" format, but I am trying to add in the second formula to format that source data in "First Name, Last Name" instead.

Please help! Thanks so much in advance.

1710182574511.png
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
To MSO365:

Excel Formula:
=TRIM(LET(a,XLOOKUP(F4,'EmpExport(3.11.24)'!E:E,'EmpExport(3.11.24)'!BC:BC),TEXTAFTER(a,",")&", "&TEXTBEFORE(a,",")))
 
Upvote 1
Solution
To MSO365:

Excel Formula:
=TRIM(LET(a,XLOOKUP(F4,'EmpExport(3.11.24)'!E:E,'EmpExport(3.11.24)'!BC:BC),TEXTAFTER(a,",")&", "&TEXTBEFORE(a,",")))
THANK YOU SO MUCH! It was driving me crazy. I tried it a dozen ways, but missed the "a," after the LET!
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,178
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