Results 1 to 5 of 5
  1. #1
    prateekjas is offline Novice
    Windows 7 64bit Access 2016
    Join Date
    Jan 2020
    Posts
    1

    Replicate formula of excel in access

    Hi



    I have 2 columns i.e. Period/Date (Col A) and code (Col B). It just check which code is present in previous month

    =COUNTIFS(A:A,DATE(YEAR(A2),MONTH(A2)-1,1),B:B,B2)

    How can i replicate same formula in access.

    Thanks

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    Dcount("*","query")
    or
    build a query that counts the dates range given. then Dcount will give the result.

  3. #3
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,428
    access is not excel - would be better if you provided some example data and the result required. Plus where you want to use this - in a query? on a form or report? as a single value? or multiple rows?

    you might use sql or perhaps as ranman suggests the dcount function

    With regards your excel formula, how does it work if A2 is a date in January? Month would then be 0.

  4. #4
    apr pillai's Avatar
    apr pillai is offline Competent Performer
    Windows 10 Access 2007
    Join Date
    May 2010
    Location
    Alappuzha, India
    Posts
    209

  5. #5
    ssanfu is offline Master of Nothing
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Welcome to the forum.....

    Are the dates in "Period/Date" (Col A) below A2 ALWAYS going to be the first day of the month?
    That is what the formula is looking for, no matter what date is entered into A2.



    Given the dates and codes below, what would the count be?

    A
    B
    1
    2
    12/20/2019
    Code3
    3
    4
    11/5/2019 Code3
    5
    11/1/2019
    Code3
    6
    11/24/2019 Code3
    7 11/19/2019 Code3
    8 11/1/2019 Code10

    Based on your formula, I would think the count would be 1. Is that what you want?
    Or should the count be 4??? (ANY day in the month and B2 = "Code3")



    I would write a function (a UDF) to return the count.
    Do you have a database started? Would you post a copy?

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Excel Formula To Access
    By JHG in forum Access
    Replies: 15
    Last Post: 08-05-2019, 09:13 AM
  2. Excel formula to access vba.
    By tonycl69 in forum Programming
    Replies: 2
    Last Post: 10-20-2016, 06:36 AM
  3. Replies: 19
    Last Post: 07-13-2015, 10:15 AM
  4. Replies: 41
    Last Post: 05-29-2015, 02:58 PM
  5. Using an Excel Formula in Access
    By BEI77 in forum Access
    Replies: 6
    Last Post: 05-08-2014, 05:08 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums