+ Reply to Thread
Results 1 to 7 of 7

How to select stock sizes from user input

  1. #1
    Registered User
    Join Date
    01-04-2018
    Location
    West Midlands
    MS-Off Ver
    Microsoft Office Professional 2010
    Posts
    14

    How to select stock sizes from user input

    Hi!

    First time poster here. I use Excel version 14 on Microsoft Office Professional 2010.

    I'd like the spreadsheet to automatically select an appropriate material blank size based on the maximum diameter inputted by the user. The stock size needs to be a minimum of 0.5mm larger than the max diameter. There is a long list of sizes, but rather unhelpfully they don't go up in equal increments. If you're interested, the sizes are 80 90 100 115 120 130 140 150 160 170 180 200 220 240.

    I'm guessing I need to use IF and THEN type of logic, but I don't have experience with using it on Excel (and I have never used macros or visual basic). How should I go about doing this?

    The next stage is to select the length. This is a bit more straight forward, but it will still require me to use a command that I don't know the name of.

    The blank length is based on the max width of the part. The width needs to be rounded up to the nearest whole millimeter, then 4 mm gets added on. So 12.7 becomes 17, 11.1 becomes 16 and 18.0 becomes 22. How do I go about doing this one?

    Many thanks in advance,

    Stephen

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,914

    Re: How to select stock sizes from user input

    Welcome to the forum!

    Will you please attach a sample Excel workbook? Nobody wants to have to create your data from scratch.

    1. Make sure that your sample data are REPRESENTATIVE of your real data. The use of unrepresentative data is very frustrating and can lead to long delays in reaching a solution.

    2. Make sure that your desired results are also shown (mock up the results manually).


    3. Make sure that all confidential data is removed or replaced with dummy data first (e.g. names, addresses, E-mails, etc.).

    4. Try to avoid using merged cells as they cause lots of problems.

    Unfortunately the attachment icon doesn't work at the moment, so to attach an Excel file you have to do the following: just before posting, scroll down to Go Advanced and then scroll down to Manage Attachments. Now follow the instructions at the top of that screen.

    Please pay particular attention to point 2 (above): without an idea of your intended outcomes, it is often very difficult to offer appropriate advice.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  3. #3
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,055

    Re: How to select stock sizes from user input

    For the diameters:
    =INDEX($G$2:$G$15,MATCH(A2+0.5,$G$2:$G$15,1)+1)

    For the lengths:
    =ROUNDUP(A5,0)+4

    see sheet for context.
    Attached Files Attached Files
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

  4. #4
    Registered User
    Join Date
    01-04-2018
    Location
    West Midlands
    MS-Off Ver
    Microsoft Office Professional 2010
    Posts
    14

    Re: How to select stock sizes from user input

    Ok, here goes!
    Attached Files Attached Files

  5. #5
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,914

    Re: How to select stock sizes from user input

    Have a look at Glenn's suggestion in post #3.

  6. #6
    Registered User
    Join Date
    01-04-2018
    Location
    West Midlands
    MS-Off Ver
    Microsoft Office Professional 2010
    Posts
    14

    Re: How to select stock sizes from user input

    Thanks for the method, Glenn!

    How do the two commands work? I can sort of see how the first one works, but am unsure what the +1 at the end is needed for

  7. #7
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,055

    Re: How to select stock sizes from user input

    easy one first:

    =ROUNDUP(A5,0)+4 - round A5 up to zero decimal places and add 4.

    =INDEX($G$2:$G$15,MATCH(A2+0.5,$G$2:$G$15,1)+1)

    MATCH returns a row number that corresponds to the largest value that is less than or equal to A2+0.5. The values in the list must be placed in ascending order. the +1 means then go to the next value down the list. INDEX returns the corresponding value, from the row number.



    You're welcome.



    If that takes care of your original question, please select "Thread Tools" from the menu link above and mark this thread as SOLVED.

    It'd also be appreciated if you were to click the Add Reputation button at the foot of any of the posts of all members who helped you reach a solution.

+ 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. User Input - How to display/select
    By jgupte in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-30-2014, 10:19 AM
  2. Input Box - Sheets freeze and user cannot select
    By Excel Guy 123 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-13-2013, 03:21 PM
  3. Autofilter to select a range from user input
    By santu03 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-31-2013, 12:11 AM
  4. Replies: 0
    Last Post: 01-16-2013, 05:44 AM
  5. Select Data Based on User Input
    By scurveydog in forum Excel General
    Replies: 2
    Last Post: 10-03-2010, 12:31 PM
  6. User Select Range Through Input Box
    By bdb1974 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-21-2009, 04:47 PM
  7. [SOLVED] using input from user to select wk1 to wk52
    By bigdaddy3 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 10-14-2005, 02:05 PM

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