Hello!
I have a set of data in Access (in short text format) with <numbers, decimals numbers, whole numbers, and empty cells. I need that set of data in a new calculated query field where the <numbers no longer have the < sign and are halved (or averaged with themselves), where decimal and whole numbers stay the same, and where the empty cells stay empty while converting them all to a number format (except the empty cells).
I can do this in Excel using a VBA nested IF formula:
The problem is that I need to do it in Access, but the ISBLANK function does not exist in SQL. In Access I’m using the Expression: Val(IIf(Left([field_name],1)=”<”,Val(Mid([field_name],2,4))/2,[field_name])), but this places 0’s in the new column where I need them to remain empty cells:
How can I write an expression that does what I have it doing in Excel, but do it in Access?
The reason I need those cells to remain empty is because I will be preforming calculations later in Excel with the newly calculated query field of data (which needs to be in number format to do so) and having those 0’s in the cells will alter the calculations because they’ll be factored in when they shouldn’t be. I can't just find and replace the 0's in Excel with nothing either, because some of the data points are actually 0's which do need to be factored in.
I have tried the IsNull and IsEmpty functions, and they don't work. I am very new to Access and SQL, so perhaps there is another way that I am not aware of.
I have a set of data in Access (in short text format) with <numbers, decimals numbers, whole numbers, and empty cells. I need that set of data in a new calculated query field where the <numbers no longer have the < sign and are halved (or averaged with themselves), where decimal and whole numbers stay the same, and where the empty cells stay empty while converting them all to a number format (except the empty cells).
I can do this in Excel using a VBA nested IF formula:
The problem is that I need to do it in Access, but the ISBLANK function does not exist in SQL. In Access I’m using the Expression: Val(IIf(Left([field_name],1)=”<”,Val(Mid([field_name],2,4))/2,[field_name])), but this places 0’s in the new column where I need them to remain empty cells:
How can I write an expression that does what I have it doing in Excel, but do it in Access?
The reason I need those cells to remain empty is because I will be preforming calculations later in Excel with the newly calculated query field of data (which needs to be in number format to do so) and having those 0’s in the cells will alter the calculations because they’ll be factored in when they shouldn’t be. I can't just find and replace the 0's in Excel with nothing either, because some of the data points are actually 0's which do need to be factored in.
I have tried the IsNull and IsEmpty functions, and they don't work. I am very new to Access and SQL, so perhaps there is another way that I am not aware of.
Last edited: