IIF with multiple Null values

touchmove

New Member
Joined
May 18, 2015
Messages
10
Hi everyone!

I am currently designing applicants access database and below details troubled me so far:

ABCD
IDFROMTOEXP
110/1/201411/1/2015
210/2014
32.75

<tbody>
</tbody>

I want to add a calculated field by using access query which would result the years of experience:

Data above is based on different resume sent to me. Some resume just have years of experience without specific dates that's why I create another field for such data (column D)

Now, here's what I want regarding null values:

ID 1: Column C - Column B (using IIF Null DateDiff)
ID 2: "present" (as the applicant is currently working)
ID 3: 2.75 (just get the value if Column B and Column C is null

I had made good result with ID 1 and 3 but fails with ID 2.


Expr1: IIf([From] Is Null,[Years],IIf([Years] Is Null,DateDiff("yyyy",[From],[To])))



Your help will be very much appreciated:
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
After several trial and error attempts using this code:

Expr1: IIf([To] Is Null And [Years] Is Null,"present",IIf([From] Is Null,[Years],IIf([Years] Is Null,DateDiff("m",[From],[To])/12)))


The result:


IDFromToYearsExpr1
110/1/201411/1/2015
1.08333333333333
210/1/2014

present
3

2.752.75

<caption> experience Query </caption><thead>
</thead><tbody>
</tbody><tfoot></tfoot>


Question: Can I make the number result into 2 decimal places whereas there is text value (present) in the field?
 
Upvote 0
You can use the ROUND function to round your calculation to two decimal places.

By the way, I deleted your duplicate post. Please do not post the same question multiple times. Per forum rules, duplicate posts will be locked or deleted.

Thanks
 
Upvote 0
Do I need to make another calculated field or insert round off function to the existing IIF function (which is so frustrating to beginner like me)?

Thanks for the reply.
 
Upvote 0
Just insert it in your formula, the specific calculation part, i.e.

..., ROUND(calculation formula,2), ...
 
Upvote 0

Forum statistics

Threads
1,214,585
Messages
6,120,391
Members
448,957
Latest member
Hat4Life

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