Help with between formula in access

ariel20029

Board Regular
Joined
Jun 20, 2013
Messages
97
Hi,
I am trying to write an iif statement in an access query if the date from the CATS is between the start and end date from TABLE return WKDate else nothing. Can you please help.
Sharon

CATS!:iif([CATS]![Date] >=
![Start] and< =
![end]
![WK Date] )
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
Try:
Code:
[COLOR=#333333]iif(([CATS]![Date] >= [Table]![Start]) and ([/COLOR][COLOR=#333333][CATS]![Date][/COLOR][COLOR=#333333]<=[Table]![end]),[Table]![WK Date],"")[/COLOR]
 
Upvote 0
Hi,

I don't think an IIF would come to the correct answer.
try this instead:

week: DLookUp([wk date];"table";[date] Between
![start] And
![end])

make sure you have add Table to the query as well.

Other option would be to use the date and use the DatePart function to get the weeknumber

week: DatePart("ww",[CATS]![DATE])

Hope this helps.
 
Last edited:
Upvote 0
I was so focused on the construct issues with the formula, I didn't look close enough at what was being asked.
jorismoerings is correct. You cannot "lookup" a value with an IIF statement. An IIF statement will only work like that if the two tables are already joined within the query.
You would need to use a DLOOKUP formula like shown, or possibly create a query between the two tables (doesn't need to be joined), but put the conditions in the WHERE clause.
 
Upvote 0

Forum statistics

Threads
1,221,788
Messages
6,161,963
Members
451,734
Latest member
Adapt375

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