How can I add a symbol to an xlookup output

Cypt2o

New Member
Joined
Sep 10, 2024
Messages
3
Office Version
  1. 365
Platform
  1. Windows
Hello everyone I have the following formula:

XLOOKUP($M$5,'In Shop List'!C:C,'In Shop List'!A:A,"Update Inshop")

My result output is a number sequence show below.

202408100055

I would like to add a dash "-" inside the returned output. Example below:

20240810-0055

How would I go about doing this. Any is appreciated.
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
Welcome to the Board!

Where it is returning the value from, are the entries made as Text or Numeric?
Due to the length, I am guessing that they are Text or else the value coming back would probably be in Scientific Notation.
Will it always return a 12 digit number, and you want to add the dash after the 8th character?
 
Upvote 0
It will always return a 12 digit number. The value return is text.

Yes. The dash after the 8th character.
 
Upvote 0
How about
Excel Formula:
=LET(x,XLOOKUP($M$5,'In Shop List'!C:C,'In Shop List'!A:A,"Update Inshop"),IF(x="Update Inshop",x,REPLACE(x,9,0,"-")))
 
Upvote 0
OK, try this formula:
Excel Formula:
=LET(x,XLOOKUP($M$5,'In Shop List'!C:C,'In Shop List'!A:A,"Update Inshop"),LEFT(x,8)&"-"&RIGHT(x,4))
 
Upvote 0
Solution
Joe, that will cause a problem if the xlookup returns "Update Inshop" ;)
 
Upvote 0
Both solutions worked. Thank you both for your assistance.
 
Upvote 0
Joe, that will cause a problem if the xlookup returns "Update Inshop" ;)
Ah, yes. I guess I should have analyzed the original formula more deeply to see exactly what it is doing in all situations.

Cypt2o,​

I would recommend using Fluff's solution, as it is more complete.
 
Upvote 0

Forum statistics

Threads
1,221,519
Messages
6,160,294
Members
451,636
Latest member
ddweller151

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