Vlookup the result of a function

Godders199

Active Member
Joined
Mar 2, 2017
Messages
313
Office Version
  1. 2013
Good afternoon, trying To set up a spreadsheet that populates the name of the person who opened it.
we are using a function =displayusername() Which works and gives me the staff number. However when I do a vlookup on the staff number I just get #n/a.
I know the vlookup is correct as if I delete the function and type in the staff number it works correctly.
i Have never tried to search the result of a function before, so am wondering if I need to do something different , from =vlookup(c1,hierarchy!d:i,6,false)? . Any help appreciated.
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
Sounds as though either the function is returning a text rather than a number & your lookup table has numbers, or vice-versa
 
Upvote 0
Sounds as though either the function is returning a text rather than a number & your lookup table has numbers, or vice-versa
Thanks, the cells is formatted as “general” , is there a way to check it is returning a text value? Or add something to the function to ensure it returns a number?
the function code is.
set objNetwork = CreateObject(“Wscript.Network”)
DisplayUserName = objNetwork.UserName.

thanks
 
Upvote 0
You can check if it's a number or not by putting this in another cell
Excel Formula:
=isnumber(C1)
change the C1 to look at the cell with the function.
 
Upvote 0
You can check if it's a number or not by putting this in another cell
Excel Formula:
=isnumber(C1)
change the C1 to look at the cell with the function.
Thank you much appreciated, can see it is a text value now.
 
Upvote 0
Ok, if it needs to be a number, then you can multiply the function result by 1
 
Upvote 0

Forum statistics

Threads
1,214,596
Messages
6,120,438
Members
448,966
Latest member
DannyC96

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