+ Reply to Thread
Results 1 to 4 of 4

Macro to input data on specific cell based on range of another cell data

  1. #1
    Registered User
    Join Date
    12-02-2013
    Location
    Miami
    MS-Off Ver
    Excel 2003
    Posts
    3

    Lightbulb Macro to input data on specific cell based on range of another cell data

    Hello,

    I´m in need of a Macro or several macros I don´t know that does the following. I have a column in which I input some data. Let´s call it pounds. Next to that column I have several more, 1-20, 21-30, 31-50, 50-100, and 100 or more. All these are pounds. Under the first column ¨pounds¨, I will input the number of pounds, and I want the macro to place another number under the corresponding column based on the ¨pounds¨column. For example: If I input 15 pounds, that should input 100 under the 1-20 column. My data table is the following:

    1-20 = 100
    21-30 = 275
    31-50 = 375
    51-100 = 475
    ....

    PLEASE HELP!

    THANKS!

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Macro to input data on specific cell based on range of another cell data

    Welcome to the Forum!

    The explanation is a bit confusing. If you input 15, it makes sense that you would want something to go into the column 1-20, since 15 is in the range 1-20. But why do you put 100 in that column? Where do all those other numbers come from (275, 375, 475)?

    I suggest attaching a sample file showing your data layout with examples of what you want the results to look like and an explanation of how to get those results.

    To post a file:
    1. Under the text box where you type your reply click the Go Advanced button.
    2. In the next screen look above the reply box and click the "paper clip" icon. You will get a pop-up screen.
    3. In the pop-up, click Add then Select to select a file from your local drive
    4. Click the Upload button to upload the file
    5. Click Done to attach it.

    It will be displayed as an attachment underneath your post text. Alternatively as the last step you can click the Insert Inline button and a hyperlink to the file will be inserted directly into your post text in the spot where your cursor is set at the moment you click the button.
    Jeff
    | | |·| |·| |·| |·| | |:| | |·| |·|
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Registered User
    Join Date
    12-02-2013
    Location
    Miami
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: Macro to input data on specific cell based on range of another cell data

    Thanks for the help! Attached is the file requested. It states a price table to show where I get my 100 and 275 and so forth from. THANKS!

    sample.xlsx

  4. #4
    Registered User
    Join Date
    12-02-2013
    Location
    Miami
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: Macro to input data on specific cell based on range of another cell data

    Quote Originally Posted by 6StringJazzer View Post
    Welcome to the Forum!

    The explanation is a bit confusing. If you input 15, it makes sense that you would want something to go into the column 1-20, since 15 is in the range 1-20. But why do you put 100 in that column? Where do all those other numbers come from (275, 375, 475)?

    I suggest attaching a sample file showing your data layout with examples of what you want the results to look like and an explanation of how to get those results.

    To post a file:
    1. Under the text box where you type your reply click the Go Advanced button.
    2. In the next screen look above the reply box and click the "paper clip" icon. You will get a pop-up screen.
    3. In the pop-up, click Add then Select to select a file from your local drive
    4. Click the Upload button to upload the file
    5. Click Done to attach it.

    It will be displayed as an attachment underneath your post text. Alternatively as the last step you can click the Insert Inline button and a hyperlink to the file will be inserted directly into your post text in the spot where your cursor is set at the moment you click the button.

    Hello, please see attached file on my last post

  5. #5
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Macro to input data on specific cell based on range of another cell data

    I had to make some changes to make this automatic. Whenever you are using numbers in Excel and those numbers are meaningful, it is better to use numbers than text strings that contain the numbers. In your case you have a range of weights

    0-20

    but it is better to put the actual numbers into two columns

    0 20

    That way you can write formulas that refer to them, and it is much easier if something changes.

    BTW the prices you had in your sample grid didn't match your price list. This solution looks up prices in the price list.

    Note: This can be done with formulas, no macro is required.
    Attached Files Attached Files
    Last edited by 6StringJazzer; 12-03-2013 at 12:42 PM. Reason: see end note

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 14
    Last Post: 01-22-2013, 12:07 PM
  2. [SOLVED] Macro - Copy and Paste to a Specific Row based on the input in a cell
    By usc1382 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-22-2012, 05:05 PM
  3. Input data to specific cell based on multiple dropdowns
    By cpercival in forum Excel General
    Replies: 6
    Last Post: 02-28-2011, 10:13 AM
  4. Can name range display value based on the input of specific cell?
    By rusoo7 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 03-24-2010, 11:17 AM
  5. Select data range based on specific cell
    By cmb80 in forum Excel General
    Replies: 0
    Last Post: 01-22-2010, 06:36 AM

Tags for this Thread

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