Calculated Formula on table not working

ensmith

New Member
Joined
Oct 25, 2011
Messages
48
I am trying to create the below excel formula on a access table and it is not working. Any suggestions, thanks.

Excel formula
- =IF(ISBLANK(G2),F2,IF(G2="UNKNW",F2,G2))

CDEFG
1YearAcctComp CodeBILL_CDPAYOR_CD
220140000000CMMH34UNKNW

<tbody>
</tbody>

Access table formula - IsNull( [PAYOR_CD] , [BILL_CD] , IF( [PAYOR_CD] ="UNKNW", [BILL_CD], [PAYOR_CD] ))

YearAcctComp CodeBILL_CDPAYOR_CD

<tbody>
</tbody>
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
It is not advisable to calculate fields in database tables. All calculations should be performed in either a form or a query. Data is static in tables, and if some data were to change, then all of the calculations in the table would need to be re-calculated. This could be a large job. Keeping calculations in queries, allows them to be performed when the query is run and if data has changed, then the calculation is correct at the time of running.

Looking at your expression (database term for formula), there is no IF function, you need to use an IIF function.
In a query, you would create a new field and insert your expression there.
 
Upvote 0
It is not advisable to calculate fields in database tables. All calculations should be performed in either a form or a query. Data is static in tables, and if some data were to change, then all of the calculations in the table would need to be re-calculated. This could be a large job. Keeping calculations in queries, allows them to be performed when the query is run and if data has changed, then the calculation is correct at the time of running.

Looking at your expression (database term for formula), there is no IF function, you need to use an IIF function.
In a query, you would create a new field and insert your expression there.


Thanks for your advice.
 
Upvote 0
Can you tell me if I am something in this query formula because it is not working?

IIf(IsNull( [1 - NE Payor Detail]![PAYOR_CD] , [1 - NE Payor Detail]![BILL_CD] ),IIf( [1 - NE Payor Detail]![PAYOR_CD] ,"UNKNW", [1 - NE Payor Detail]![BILL_CD] ))
 
Upvote 0
You formula is all messed up. In addition to having parentheses in the wrong place, you also want to check to see if it is equal to "UNKNW", so you want an equal sign there, not a comma.

You don't need to do it as a nested IIF anyhow, you can just use OR, i.e.
Code:
[COLOR=#333333]IIf(IsNull([1 - NE Payor Detail]![PAYOR_CD]) OR ([1 - NE Payor Detail]![PAYOR_CD]="UNKNW"), [1 - NE Payor Detail]![BILL_CD],[/COLOR][COLOR=#333333][1 - NE Payor Detail]![PAYOR_CD][/COLOR][COLOR=#333333])[/COLOR]
 
Upvote 0

Forum statistics

Threads
1,215,054
Messages
6,122,901
Members
449,097
Latest member
dbomb1414

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