Results 1 to 9 of 9

Thread: TRANSLATE EXCEL CODE TO ACCESS CALCULATION

  1. #1
    VBAX Regular
    Joined
    May 2012
    Posts
    79
    Location

    TRANSLATE EXCEL CODE TO ACCESS CALCULATION

    I am very much a beginner on Access and am trying to migrate an Excel workbook into an Access Database as it is far more suitable. However, one piece I am stuck on is replicating the following formula in Access format:

    =SUMPRODUCT(('Source Data'!$L$2:$L$500="PERFORMANCE")*('Source Data'!$E$2:$E$500="I")*('Source Data'!$I$2:$I$500<>"Subcontractor"))

    How can I do a calculated field to count 3 sets of data over the 3 column headings?

    Any help greatly appreciated.

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,446
    Location
    I assume you will run a query? What are the tables and column names?
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3
    VBAX Regular
    Joined
    May 2012
    Posts
    79
    Location
    Quote Originally Posted by xld View Post
    I assume you will run a query? What are the tables and column names?
    Hi, it is one table called Monthly Extract and the columns are

    Branch
    D/I
    Position Name

  4. #4
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,446
    Location
    Something like

    SELECT Count(Branch) AS [Count]
    FROM [Monthly Extract]
    WHERE ((([Monthly Extract].[Branch])="PERFORMANCE") AND (([Monthly Extract].[D/I])="I") AND (([Monthly Extract].[PositionName])<>"SubContractor"));
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  5. #5
    VBAX Regular
    Joined
    May 2012
    Posts
    79
    Location
    Quote Originally Posted by xld View Post
    Something like

    SELECT Count(Branch) AS [Count]
    FROM [Monthly Extract]
    WHERE ((([Monthly Extract].[Branch])="PERFORMANCE") AND (([Monthly Extract].[D/I])="I") AND (([Monthly Extract].[PositionName])<>"SubContractor"));
    Sorry, I am a beginner, where do I put that code?

  6. #6
    VBAX Guru mancubus's Avatar
    Joined
    Dec 2010
    Location
    "Where I lay my head is home" :D
    Posts
    2,645
    it's a query.
    Create -> Querius -> Query Design
    close Show Table dialog.
    click SQL button in the bottom right corner.
    paste the query here.
    then save as query (with a meaningful name).
    PLS DO NOT PM; OPEN A THREAD INSTEAD!!!

    1) Posting Code
    [CODE]PasteYourCodeHere[/CODE]
    (or paste your code, select it, click # button)

    2) Uploading File(s)
    Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s) (multiple files can be selected while holding Ctrl key) / Upload Files / Done
    Replace company specific / sensitive / confidential data. Include so many rows and sheets etc in the uploaded workbook to enable the helpers visualize the data and table structure. Helpers do not need the entire workbook.

    3) Testing the Codes
    always back up your files before testing the codes.

    4) Marking the Thread as Solved
    from Thread Tools (on the top right corner, above the first message)

  7. #7
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,446
    Location
    I am surprised that you want to do this in Access but don't know what a query is?
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  8. #8
    VBAX Regular
    Joined
    May 2012
    Posts
    79
    Location
    Forgive my ignorance, as I said I am a beginner but I do know what a query is but not so good on writing SQL. When I put that query in and I click Run it just asks me for Parameter Values?

  9. #9
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,446
    Location
    That suggests that your table and/or column names are not exactly as given, the table and query do not match up.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •