+ Reply to Thread
Results 1 to 9 of 9

userform calculations (Count, Sum, Subtract) treaky one

  1. #1
    Forum Contributor
    Join Date
    08-08-2012
    Location
    englang
    MS-Off Ver
    Excel 2010
    Posts
    152

    userform calculations (Count, Sum, Subtract) treaky one

    Hi guys,

    I'm currently working on the database for use at work and i would like to improve the code below with couple more functions in my userform.
    For me it looks too complicated, maybe somebody would be so kind and help me with this code. I have also attached my file for your reference.

    Thanks in advance for your help

    This code is triggered after i put any value in the textbox then it looks for part number in the "Update" tab and counts how many times this part number appears in column ("Q2:Q") and then depending on count result it shows nothing or "No Sample" in the "Skip" label.

    I would like to add some improvements to this code and here comes complicated part:
    after i will input any value into the textbox the code should:
    1. go to "Database" tab and sum all majors and minors for this part number; Part numbers are listed in the "Database" tab column "F2:F", Majors in column "P2:P", Minors in column "O2:O". Majors and minors are numbers.
    2. if this part number has no majors or minors (basically if all cells in column P and O are blank for this part number) proceed with the code below otherwise substract (-) the sum of majors and minors from the count result in the "Update" tab.
    For example part number "PN1234567" has been booked 10 times(counts in the Update tab column Q) and we summed 3 majors and no minors for this part number (summing in Database tab columns P and O) it should look like this : 10-3=7, basically we need to do this simple calculation. Of course if we will find more majors and minors then the bookings it should look like that: for example 15bookings-10majors-10minors = -5
    3. and finally knowing the final result we can select the case as in the code below.


    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by intex; 08-16-2014 at 06:10 PM.

  2. #2
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: userform calculations (Count, Sum, Subtract) treaky one

    Your Userform does not work like you describe it.

    Please amend your description so I can understand your requirements.
    Last edited by mehmetcik; 08-16-2014 at 06:46 PM.

  3. #3
    Forum Contributor
    Join Date
    08-08-2012
    Location
    englang
    MS-Off Ver
    Excel 2010
    Posts
    152

    Re: userform calculations (Count, Sum, Subtract) treaky one

    Hi mehmetcik,

    how do you think is it possible to make this work?

  4. #4
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: userform calculations (Count, Sum, Subtract) treaky one

    It is very simple to do what you ask.

    I can find and select every occurrance of your part number in column F.

    I can select every appearance of a part number in column Q, then I can step through every cell and count them.

    I can then loop through every selected cell and count the values in column O & P in that row.

    Thats what I can do, but your requirements other than that are not clear.

  5. #5
    Forum Contributor
    Join Date
    08-08-2012
    Location
    englang
    MS-Off Ver
    Excel 2010
    Posts
    152

    Re: userform calculations (Count, Sum, Subtract) treaky one

    I will try to explain a bit better.
    i Have attached a screenshots to make it more understandable.

    After everything what is in the screenshots done i would like to have case executed as in code below:

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

  6. #6
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: userform calculations (Count, Sum, Subtract) treaky one

    Start with the basics.

    Do I click on Userform in Checksheet to see the Userform?

    Where do I put the part number? Most of the Userform is made up of Labels

    When i put my part number in what do I press.

    The part number you Quote does not appear in the database

    The nearest code does not appear ten times

    No code has three majors listed.

    See my confusion?

  7. #7
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: userform calculations (Count, Sum, Subtract) treaky one

    Start with the basics.

    Do I click on Userform in Checksheet to see the Userform?

    Where do I put the part number? Most of the Userform is made up of Labels

    When i put my part number in what do I press.

    The part number you Quote does not appear in the database

    The nearest code does not appear ten times

    No code has three majors listed.

    See my confusion?

  8. #8
    Forum Contributor
    Join Date
    08-08-2012
    Location
    englang
    MS-Off Ver
    Excel 2010
    Posts
    152

    Re: userform calculations (Count, Sum, Subtract) treaky one

    i have attached more screenshots explaining what is what
    Also just to make it more clear the userform retrieves information from the Update tab
    After all data is entered in userform i have to press Update button in userform to copy everything into the Database tab.
    Attached Files Attached Files
    Last edited by intex; 08-16-2014 at 08:22 PM.

  9. #9
    Forum Contributor
    Join Date
    08-08-2012
    Location
    englang
    MS-Off Ver
    Excel 2010
    Posts
    152

    Re: userform calculations (Count, Sum, Subtract) treaky one

    Guys i'm so stuck,
    maybe somebody can help me on this?

+ 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. Subtract variable from UserForm TextBox
    By Nu2Java in forum Excel General
    Replies: 6
    Last Post: 10-10-2012, 10:11 PM
  2. [SOLVED] Userform Textbox Date - Subtract Weekend
    By Nu2Java in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-12-2012, 05:14 PM
  3. Userform help: to subtract from one cell and add to another
    By onetimesten in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-10-2012, 05:18 PM
  4. Replies: 1
    Last Post: 01-27-2012, 11:25 PM
  5. Calculations in UserForm - Need Help
    By chester.stevenson1 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-28-2011, 03:33 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