+ Reply to Thread
Results 1 to 9 of 9

ms excel query to calculate

  1. #1
    Registered User
    Join Date
    05-24-2013
    Location
    romania
    MS-Off Ver
    Excel 2003
    Posts
    5

    ms excel query to calculate

    I am new in excel query. I have a database and I extract data from it, but I want also to calculate the ratio number/previous numbr. Can anyone help me?

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,890

    Re: ms excel query

    Suggest you post an example of what you are trying to do. Post what your data looks like, and what you would expect it to look like after extraction.
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Registered User
    Join Date
    05-24-2013
    Location
    romania
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: ms excel query

    I have a database like this:
    year earning
    2000 25
    2001 50
    2002 75 and I want to calculate the ratio earning in 2002/earning 2001 and the same for all the years. It is possible with query. I want to avoid bringing the data and then type the formula in excel.

  4. #4
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,890

    Re: ms excel query

    You will need to get the previous value into the current record. Than you can create an expression in your query to calculate the ratio.

    Here is a link to show you how to do that. Scroll down to the section "Get the value in another record."

    http://allenbrowne.com/subquery-01.html

  5. #5
    Registered User
    Join Date
    05-24-2013
    Location
    romania
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: ms excel query

    Thank you very much for the reply but for the moment I still don't know how to do it.

  6. #6
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,890

    Re: ms excel query to calculate

    Perhaps if you uploaded your data base, we could provide an specific response.

  7. #7
    Registered User
    Join Date
    05-24-2013
    Location
    romania
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: ms excel query to calculate

    My database file is like this:
    Data cpi
    2000 102
    2001 103
    2002 112
    2003 123
    2004 130
    2005 135
    2006 138
    2007 142
    2008 145
    And I query the value cpi in another excel file. I want to calculate the ratio cpi value to cpi previous value (ex: 103/102 and the same for all the years). I know I can do this after I brought the data into my excel file, but I want to know how to do this in a query and have the data calculated in my new file.

  8. #8
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,890

    Re: ms excel query to calculate

    See attached. I was hoping that you would upload your database so that I would not have to recreate it. This is proper etiquette in Forums. Time is valuable for all of us. Help us to help you in the future.
    Attached Files Attached Files

  9. #9
    Registered User
    Join Date
    05-24-2013
    Location
    romania
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: ms excel query to calculate

    thank you very much

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1