#Func! Error I can’t get around

Ryan Chadwick 0 Reputation points
2024-04-21T02:34:58.9933333+00:00

I have a column of data ([Premium Hdr].[Rev]) that contains blanks, letters and strings containing letters+numbers. I need to do a Nz on the blanks, trim the + and numbers if they are there, and if there are just letters, return that in a calculated column.

Column:

blank

A

B+1

C+23

QQ

CCB+2

My statement handles the Nz stuff fine, handles the + trim fine, but returns a #func! if there isn’t a + for the statement to work against.

IIF(IsNull([Prem Hdr].[Rev]),””,IIf(IsError(Left(Nz([Prem Hdr].[Rev],””),InStr(Nz([Prem Hdr].[Rev],””),”+”)-1)),[Prem Hdr].[Rev],Left(Nz(Prem Hdr].[Rev],””),InStr(Nz([Prem Hdr].[Rev],””),”+”)-1)))

Access
Access
A family of Microsoft relational database management systems designed for ease of use.
312 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Ryan Chadwick 0 Reputation points
    2024-04-22T15:10:45.9866667+00:00

    Changing the iserror to an InStr = 0 allows for an initial value without a + to be handled correctly

    0 comments No comments