+ Reply to Thread
Results 1 to 7 of 7

[VBA] Userform Combobox filters prices in a form of price range

  1. #1
    Registered User
    Join Date
    03-24-2013
    Location
    Quezon City, Philippines
    MS-Off Ver
    Excel 2010/2013
    Posts
    83

    [VBA] Userform Combobox filters prices in a form of price range

    Hi all!

    I have an excel file where in it can filter 7 out of 9 columns. My problem is that I have many prices in one column and what I want to do is when the user wants to filter it by price ranges the following price ranges will be seen in the combobox and when that price range is clicked, only the prices in that range will be seen.

    the price ranges are:
    "Contact Seller For Price"
    "0-200k"
    "201k-500k"
    "501k-1M"
    "1M-2M"
    "2M-5M"
    "5M-10M"
    "10M-20M"
    "20M-40M"
    "40M-50M"

    I happened to know the logic but then the problem is that I don't know how to make it into a code. Could you possibly help me doing this one?

    Thanks!

    Please see attached file.
    Attachment 336746

  2. #2
    Valued Forum Contributor
    Join Date
    09-21-2011
    Location
    Birmingham UK
    MS-Off Ver
    Excel 2003/7/10
    Posts
    2,188

    Re: [VBA] Userform Combobox filters prices in a form of price range

    Hi,

    Record yourself filtering a few as a macro, then look at the code, this will help you understand what is going on and tweak the code for your needs.
    Hope this helps

    Sometimes its best to start at the beginning and learn VBA & Excel.

    Please dont ask me to do your work for you, I learnt from Reading books, Recording, F1 and Google and like having all of this knowledge in my head for the next time i wish to do it, or wish to tweak it.
    Available for remote consultancy work PM me

  3. #3
    Registered User
    Join Date
    02-28-2012
    Location
    England
    MS-Off Ver
    Excel 2007
    Posts
    49

    Re: [VBA] Userform Combobox filters prices in a form of price range

    Filter-ListBox.xls

    Hi You may find the attached code useful. It came from another helpful website. The logic is there just take what you need.

    All the best

    Dave

  4. #4
    Registered User
    Join Date
    03-24-2013
    Location
    Quezon City, Philippines
    MS-Off Ver
    Excel 2010/2013
    Posts
    83

    Re: [VBA] Userform Combobox filters prices in a form of price range

    Quote Originally Posted by djm601 View Post
    Attachment 336790

    Hi You may find the attached code useful. It came from another helpful website. The logic is there just take what you need.

    All the best

    Dave
    Quote Originally Posted by nathansav View Post
    Hi,

    Record yourself filtering a few as a macro, then look at the code, this will help you understand what is going on and tweak the code for your needs.

    Thanks for the both of you for giving me an idea!

    Nathansav,
    I've tried recording and I seem to follow the code, the only problem I have is how to incorporate tha macro code in my existing code.

    djm601,
    Thanks for the file! I'll try to read, understand and analyze the file you gave me and maybe I could get ideas with regard to the file and my file.


    Thanks so much!

  5. #5
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: [VBA] Userform Combobox filters prices in a form of price range

    Why not instead just add a column for price range and use a formula? Then you can filter directly in the table.

    A
    B
    C
    1
    Offer Type
    Price (BDT)
    Range
    2
    Buy
    9,343,800
    5M-10M
    3
    Buy
    13,410,000
    10M-20M
    4
    Buy Contact seller for price Contact seller for price
    5
    Buy Contact seller for price Contact seller for price
    6
    Rent Contact seller for price Contact seller for price



    C2: =IFERROR(LOOKUP(B2, {0;201;501;1000;2000;5000;10000;20000;40000}*1000, {"0-200k";"201k-500k";"501k-1M";"1M-2M";"2M-5M";"5M-10M";"10M-20M";"20M-40M";"40M-50M"}), B2)
    Entia non sunt multiplicanda sine necessitate

  6. #6
    Registered User
    Join Date
    03-24-2013
    Location
    Quezon City, Philippines
    MS-Off Ver
    Excel 2010/2013
    Posts
    83

    Re: [VBA] Userform Combobox filters prices in a form of price range

    Quote Originally Posted by shg View Post
    Why not instead just add a column for price range and use a formula? Then you can filter directly in the table.

    A
    B
    C
    1
    Offer Type
    Price (BDT)
    Range
    2
    Buy
    9,343,800
    5M-10M
    3
    Buy
    13,410,000
    10M-20M
    4
    Buy Contact seller for price Contact seller for price
    5
    Buy Contact seller for price Contact seller for price
    6
    Rent Contact seller for price Contact seller for price



    C2: =IFERROR(LOOKUP(B2, {0;201;501;1000;2000;5000;10000;20000;40000}*1000, {"0-200k";"201k-500k";"501k-1M";"1M-2M";"2M-5M";"5M-10M";"10M-20M";"20M-40M";"40M-50M"}), B2)

    oh .. the problem is that I'd like to use a userform because this'll be plugged-in into a website and also this'll be a large internal database that's why it's more accurate to use a userform for this I think. The file will have 60,000 records.

  7. #7
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: [VBA] Userform Combobox filters prices in a form of price range

    OK, good luck.

+ 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. [SOLVED] Combobox on Userform not saving selection when form is closed
    By guitarsweety in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 07-01-2014, 09:46 PM
  2. [SOLVED] Userform Combobox which filters list & also remembers manually typed in info?
    By Bflare in forum Excel Programming / VBA / Macros
    Replies: 24
    Last Post: 06-12-2014, 12:20 PM
  3. [SOLVED] Compare 1 price against multiple prices and change the price according to a formula
    By CharlieAziz in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 10-16-2012, 11:05 AM
  4. [SOLVED] Extracting latest prices from a price book with past and present prices
    By benoj2005 in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 08-10-2012, 04:08 AM
  5. Replies: 2
    Last Post: 06-04-2012, 06:53 AM

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