Can I use any sort of formulas in custom formatting?

ExcelantePicante

New Member
Joined
Aug 19, 2021
Messages
1
Office Version
  1. 2016
Platform
  1. Windows
I have a report that gives the time as "8/19/2021 12:26:01 AM -04:00", but I need the " -04:00" part to be taken off. Is there any way to custom format or integrate a formula within that custom format so this would be the case?

I want to avoid altering the spreadsheet otherwise. My alternate solution is to insert a row with the formula =LEFT(A2, LEN(A2)-7) to remove the extra information. However, I would like to do this by directly changing the format of the cells themselves so I don't have to adjust anything else. Thanks for the help!
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).

jasonb75

Well-known Member
Joined
Dec 30, 2008
Messages
14,559
Office Version
  1. 365
Platform
  1. Windows
I would say that what you have is a text string rather than a valid time, if that is the case then it can not be formatted.

You could try using text to columns with - as a delimiter then skip the second column.
 

Forum statistics

Threads
1,148,018
Messages
5,744,355
Members
423,863
Latest member
teehexcel

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
Top