+ Reply to Thread
Results 1 to 5 of 5

Matching a value to a column, (rounding) and returning offset column value

  1. #1
    Forum Contributor
    Join Date
    08-01-2012
    Location
    Tampa
    MS-Off Ver
    Excel 2010
    Posts
    121

    Matching a value to a column, (rounding) and returning offset column value

    I am dealing with 2 columns like below. What I want to do, via VBA, is to provide a number, say $3050, match it against column A (rounding up if necessary) and returning the item from column B.


    For instance

    Please Login or Register  to view this content.
    Value (COL A) Perecentage (COL B)
    $3,000 95%
    $3,100 94.8%
    $3,200 94.6%
    $4000 94.4%

    3150, should return 94.6%. It should always round up and numbers should always be between 3000-15000, I know my qualifier is:
    Please Login or Register  to view this content.
    just not sure about how I should try to match the values up, thanks!

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Matching a value to a column, (rounding) and returning offset column value

    Hi,

    Do you really need a macro. With your chosen number in say D1 then
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    will give you your answer. If you really do need a macro then just tuck this formula away somewhere and read the cell value directly into your VBA variable.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Forum Contributor
    Join Date
    12-31-2012
    Location
    Jhang, Pakistan
    MS-Off Ver
    Excel 2010
    Posts
    250

    Re: Matching a value to a column, (rounding) and returning offset column value

    Please Login or Register  to view this content.

  4. #4
    Forum Contributor
    Join Date
    08-01-2012
    Location
    Tampa
    MS-Off Ver
    Excel 2010
    Posts
    121

    Re: Matching a value to a column, (rounding) and returning offset column value

    Thanks to both of you! I could do either one but im automating with access and vba so the vba alternative makes more sense I think

  5. #5
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Matching a value to a column, (rounding) and returning offset column value

    Hi,

    Do either of these help. One is a function, so enter say
    =Percentage(3150)
    in a cell.

    The other is an equivalent procedure which will result in the dResult value showing the percentage.

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.

+ 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