DannyBoyGunner

New Member
Joined
Jul 25, 2018
Messages
6
Hi Everyone,

I've got a DB that's setup to show a list of our all sub-contractors that we use. The main goal is to show details of each subbie and if they meet the approval criteria or not. This way our contracts team only place orders with approved subbies.

The main field is the 'Approval' field that is simply a YES / NO drop-down. Previously we've had simple conditional formatting on this to turn green if YES (approved) and red for NO (not approved). However, now we're wanting to push that a little further and have it reference another field called 'Date Received' which is the date we've taken the data in from the subcontractors. I presume we would setup three slightly tweaked conditional rules with the colour changes for each one and then parameters for the date field altered for each colour.

The additional formatting we're looking for is listed below:

Green – They have been approved (from the drop-list) AND the date in the 'Date Received' field is less than 12 months old

Amber – They have been approved (from the drop-list) BUT the data is between 12 months old and 24 months old and needs renewing

Red – They have not been approved and/or, the data is more than 24 months old and needs renewing and no orders can be placed


If anyone could offer any help that would be greatly appreciated.

Thanks
 

welshgasman

Well-known Member
Joined
May 25, 2013
Messages
870
Also I do not think the CF is going to work correctly. If you run this code in the immediate window, you should see the problem.

Code:
dt1=#07/31/2018#
dt2=#09/30/2016#
? datediff("yyyy",dt2,dt1)

datediff("m",dt2,dt1) > 23 would be more accurate, but still not take into account day differences.?
 
Last edited:

Some videos you may like

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.

DannyBoyGunner

New Member
Joined
Jul 25, 2018
Messages
6
You can calculate it on the form using a text box with the following expression (untested)

Code:
=IIf(Nz([Approval],"No")="No" Or DateDiff("yyyy",[Date Received],Now())>1,"Not Approved, Do not use",IIf(DateDiff("yyyy",[Date Received],Now())=1,"Approved but requires updating","Currently Approved"))

Then apply the same conditional formatting rules to this text box as you did with the above.

You should ensure that this same logic is applied if extracting data from the database using a query


Thanks very much for this as it worked a treat. I've handed it over now so will come back if there are any user issues but it does what it was meant to. Thanks again! :)
 

Watch MrExcel Video

Forum statistics

Threads
1,122,261
Messages
5,595,144
Members
413,971
Latest member
User786

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
Top