User Name formula - Non-VBA

KillerOfGiants

New Member
Joined
Dec 23, 2022
Messages
37
Office Version
  1. 365
Hello all,

I am using the following formula to extract the user name in an excel file. I cannot use VBA. The file is on SharePoint and has links to other files (both csv and xlsx files). The file path to the linked files is different based on the user that is utilizing the data. I have found the following formula to extract the UserName that is using the file, which determines the file path. It worked fine, for awhile. It broke Friday, but we thought it was just a SharePoint hiccup. But now, it won't work at all for one of the users. When I look at the UserName when I have the files open (linked files are open to extract data, so not having that issue), my username shows correctly. The other user's name shows as just the c prompt (C:). I have no idea why it started doing this when it was working before. The only thing I wonder is if it is because this user has a space in their user name, whereas the other two users, there is no space.
The UserName formula is: =LET(fullpath, INFO("DIRECTORY"),path, SUBSTITUTE(fullpath, "C:\Users\", ""),LEFT(path, FIND("\", path) - 1))

Any and all help is greatly appreciated.
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
A little bit more information. Evaluation of the formula reveals that the other user is no longer pulling the same DIRECTORY path.

The first step in when I run the formula evaluates as follows: C:\Users\MyUserName\Documents\
The first step in when the other user evaluates as follows: C:\Windows\system32\

This is where the break is occurring. We are both opening the files from the same locations in SharePoint. But the formula evaluates (now) differently for the other user. This worked for quite some time initially, but now it does not.
 
Upvote 0
Try =CELL("filename") and see if this gives you a more consistent directory.
 
Upvote 0

Forum statistics

Threads
1,223,882
Messages
6,175,164
Members
452,615
Latest member
bogeys2birdies

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