Seems to me like you are trying to find the closest time where the tag has a different value as the current value instead of what you described as
I want to show the last value and time before the actual value from the same tag with a function.
If you just want to get the last value before a particular time, you can use the PrevEvent() function instead of FindNE. This would give you the previous value timestamp, even if the value is the same as the current value though. As you say, this might give a problem if there is no event within the search time or if you are using PrevEvent() and there is no previous event in the archive. This is something that we have to check and handle.
Another thing is able using PI ACE library here, I am guessing that you probably can get a similar result by defining a PE calulation dataset in ProcessBook. Is there any reasons for using a PI ACE library here? There are similar PE functions to the ACE functions that you are using here.
This seems like more of a "VBA programming in ProcessBook" instead of a "PI System Integration" post. I'll move the post to the other forum =)