+ Reply to Thread
Results 1 to 10 of 10

Help with IF Formula & Randbetween

  1. #1
    Registered User
    Join Date
    05-03-2018
    Location
    London
    MS-Off Ver
    MS Office 365 - Pack Office 2016
    Posts
    7

    Question Help with IF Formula & Randbetween

    Hello everybody,

    I made a tab with a drop down menu in A1 with 3 Companies and 3 other tabs with the text products for each company.

    I'd like to know how to select a random text (a product in my case) from another tab depending on the Company selected.

    For exemple I tried this, but it doesn't seem to work:

    =IF(A1="Company 1";"RANDBETWEEN('Products 1'!A2:A50)";"FAILED")

    I know it's only for one Company, I'd like the formula to regroup all companies.

    Also the products have a price in the cell next to them, I'd like to show the price from the random product selected!

    Thank you for helping me! Here is the file:
    Attached Files Attached Files
    Last edited by Yankeetribe; 05-03-2018 at 08:44 AM.

  2. #2
    Forum Expert Roel Jongman's Avatar
    Join Date
    03-28-2015
    Location
    Netherlands
    MS-Off Ver
    Office 365
    Posts
    1,483

    Re: Help with IF Formula with Randbetween

    To attach your file you cannot use the paperclip icon, it is broken..

    you can however still attach a sheet bij clicking Go Advanced downright on the quickreply box
    then scroll-down to "Manage Attachments" there you can upload your sheet.

    That will be necessary to help you based on your description it is very hard to build a working formula

  3. #3
    Registered User
    Join Date
    05-03-2018
    Location
    London
    MS-Off Ver
    MS Office 365 - Pack Office 2016
    Posts
    7

    Re: Help with IF Formula with Randbetween

    Thank you! I added the file.

  4. #4
    Forum Expert Roel Jongman's Avatar
    Join Date
    03-28-2015
    Location
    Netherlands
    MS-Off Ver
    Office 365
    Posts
    1,483

    Re: Help with IF Formula with Randbetween

    One way to do it is with the attached method
    Indirect function will help you build the tab and columnreference
    the randbetween will handle selecting a random row
    the substitute function replaces the word "Company" from cell A1 into "Products"

    in the 2nd column the vloopup will lookup the price for the random item

    (Press F9 to recalculate the sheet and have excel pick another random item)

    For an easier to read formula you might want to call the product tabs after the company so company 1 instead of products 1 that will make it easer to go to the right worksheet
    Attached Files Attached Files
    Last edited by Roel Jongman; 05-03-2018 at 08:58 AM.

  5. #5
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,364

    Re: Help with IF Formula with Randbetween

    Removed by JT
    Last edited by JohnTopley; 05-03-2018 at 08:38 AM.

  6. #6
    Registered User
    Join Date
    05-03-2018
    Location
    London
    MS-Off Ver
    MS Office 365 - Pack Office 2016
    Posts
    7

    Re: Help with IF Formula & Randbetween

    Wow thank you Roel that's it! I might have more questions in the future, but you solved it!

  7. #7
    Registered User
    Join Date
    05-03-2018
    Location
    London
    MS-Off Ver
    MS Office 365 - Pack Office 2016
    Posts
    7

    Re: Help with IF Formula & Randbetween

    Is there a way to expend the formula on 10 rows but never have any duplicate in the randomly selected products?

    Also I kinda understand how the formula works but if I change the companies name and tabs name of the tabs how can I adapt the formula? (They are all different)

  8. #8
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,364

    Re: Help with IF Formula & Randbetween

    Changing tab names (to "Company 1" etc) AND getting random selection:

    In G4 down enter numbers 1 to 50

    in H4

    =RAND()

    copy down

    in A4

    =INDIRECT("'"&$A$1&"'!A"&INDEX($G$4:$G$53,MATCH(SMALL($H$4:$H$53,ROWS($1:1)),$H$4:$H$53,0))+1)

    in D4

    =VLOOKUP($A4,INDIRECT("'"&$A$1&"'!$A$2:$B$50"),2,0)

    Using Roel's file .....
    Attached Files Attached Files

  9. #9
    Registered User
    Join Date
    05-03-2018
    Location
    London
    MS-Off Ver
    MS Office 365 - Pack Office 2016
    Posts
    7

    Re: Help with IF Formula & Randbetween

    Ok I get it! Thank you very much!!

  10. #10
    Registered User
    Join Date
    05-03-2018
    Location
    London
    MS-Off Ver
    MS Office 365 - Pack Office 2016
    Posts
    7

    Re: Help with IF Formula & Randbetween

    Hello again!

    Is there another way to not have duplicates? The numbers in the same tab are no good for me, I guess I can move them in an another tab, right?

    Anyway thank you very much guys, you are my heroes!

+ 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. New formula involving randbetween
    By hhhhhhzzzz in forum Excel General
    Replies: 3
    Last Post: 08-26-2015, 10:31 AM
  2. Replies: 10
    Last Post: 07-03-2015, 04:29 PM
  3. randbetween formula
    By bakhtawar in forum Excel General
    Replies: 3
    Last Post: 03-30-2015, 02:16 AM
  4. Randbetween formula
    By cartica in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 04-14-2014, 11:33 AM
  5. Replies: 1
    Last Post: 02-10-2012, 02:53 AM
  6. randbetween formula
    By rahulbawkar2006 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-29-2011, 09:10 PM
  7. Randbetween formula
    By jgomez in forum Excel General
    Replies: 3
    Last Post: 01-06-2011, 02:21 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