+ Reply to Thread
Results 1 to 24 of 24

array formula

  1. #1
    Registered User
    Join Date
    04-14-2009
    Location
    Chicago
    MS-Off Ver
    Excel 2003
    Posts
    13

    array formula

    I need help with creating an advanced workbook using multiple worksheets.

    Scenario 1-1). On worksheet 1 (This will be my data information page) I would like to be able to enter a value. Lets say 50,000 in cell A1.

    On worksheet 3 I would like to list my reference table. IE

    A B
    1 30,000 NS - Product 1
    2 15,000 GM - Product 2
    3 75,000 VP - Product 3
    4 50,000 NS - Product 4

    On worksheet 2, I would like to show my results. IE I would like the workbook to look at the cell on worksheet 1 that was indicated 50,000 (A1) and find all of the results from worksheet 3 column A that are less than or equal to the value of the cell A1 from worksheet 1 (ie the 50,000 cell) and display them each on seperate rows by what is indicated on worksheet 3 column B.

    The result on worksheet 2 in this scenario would be

    A
    1 NS - Product 1
    2 GM - Product 2
    3 NS - Product 4

    Scenario 1-2). If the cell A1 value on worksheet 1 was changed to 100,000 then worksheet 2 would display the results of

    A
    1 NS - Product 1
    2 GM - Product 2
    3 VP - Product 3
    4 NS - Product 4

    Once I get to that level I would like to know if it is possible to add a second "narrow down" search criteria.

    For example if I added a second cell on worksheet 1 in which I entered a second search parameter perhaps NS (cell A2) would the formula be able to narrow down first the results from scenario 1-2 (100,000) using A1, then further drill down result to show below on worksheet 2

    A
    1 NS - Product 1
    2 NS - Product 4

    I'm pretty sure this is an array formula using Index and an if formula, a less than or equal to equation and multiple row output over multiple worksheets and I have no clue how to start
    Last edited by speedrcrwi; 04-15-2009 at 01:06 PM.

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Advance excel help needed (possibly an array formula)

    An array formula, or set of them, could do this, for sure. But so could Data > AutoFilter >Custom.

    ...and I believe so could ADVANCED FILTER
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Registered User
    Join Date
    04-14-2009
    Location
    Chicago
    MS-Off Ver
    Excel 2003
    Posts
    13

    Re: Advance excel help needed (possibly an array formula)

    The problem with the data filters, that has to be done with each queery. I want to design the worksheet so that anyone can go into it and enter the worksheet a1 value and it will spit out the results with no filter required...

  4. #4
    Forum Contributor
    Join Date
    03-12-2004
    Posts
    329

    re: array formula

    Try this, it does not look exactly like what you had in mind as I split column B into 2 columns to make it easier for the formula.


    HTH
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    04-14-2009
    Location
    Chicago
    MS-Off Ver
    Excel 2003
    Posts
    13

    re: array formula

    It is almost right however it doesn't seem to search if I only use cell A1. It is requiring me to enter a value in A2 as well. Is there a way to allow the formula to search by A1 if A2 is blank so that it would only search by value?

    I am not following how you did a few steps on the formla. am I anble tojust copy the formula and past into wksht2 B5if I have 5 values in the table

    I should be able to used conditional formating for the worksheet if I want the value #NUM to be "blank" by making that text white right?

  6. #6
    Forum Contributor
    Join Date
    03-12-2004
    Posts
    329

    re: array formula

    Try this.

    HTH
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    04-14-2009
    Location
    Chicago
    MS-Off Ver
    Excel 2003
    Posts
    13

    Smile re: array formula

    Can I ask one more quick question in regards to your awesome, amazing SS? Do I have to have the number identifier cell in column A on worksheet 2 and 3 or would the Row command (or some derivitive work)

    Just curious... I can easily hide that. This is fantastic. I just hope I can replicate it in the real final version!

  8. #8
    Forum Contributor
    Join Date
    03-12-2004
    Posts
    329

    re: array formula

    Yes, it is possible to replace column A with the function ROW(). Recently, I try to avoid providing that for people, esp'ly for people who don't know Excel very well. You would be fine as it appears that you have decent knowledge in Excel. However, for someone who doesn't know Excel very well or doesn't know how the formula is setup, it can be troublesome.

    Let's say in the future someone needs to modify the spreadsheet to suit some new application and he/she needs to add a new header row. It will mess up all the formula since they are referencing the row number. Thus, adding new row at the top will push everything down one row and the formula would not work properly. If the person doesn't realize this change, what he/she gets at the end is one less output (missing one product). Thus, I don't recommend it and stopped providing this for people.

  9. #9
    Registered User
    Join Date
    04-14-2009
    Location
    Chicago
    MS-Off Ver
    Excel 2003
    Posts
    13

    re: array formula

    I'm so sorry to keep bugging you your test spreadsheet worked amazing..... but now I think I broke your formula somehow. What am I doing wrong here. I am trying to expand the index that the results are based off of. 4 was an easy test example but in reality there may be 100's listed.

    All I did was add the new values into the index (names results key), then I adjusted the formula to include the new rows on the results key worksheet.... Now I am getting a #N/A.

    When I made the adjustment I pressed Shift-Control-Enter as I saw it was an array.

    I've attached the SS I've created from your helpful template.
    Attached Files Attached Files

  10. #10
    Forum Contributor
    Join Date
    03-12-2004
    Posts
    329

    re: array formula

    You cannot have arrays that are different in sizes. If you have a total of 6 products, the maximum you can assign (meet the criteria) to company ABC is 6.

  11. #11
    Registered User
    Join Date
    04-14-2009
    Location
    Chicago
    MS-Off Ver
    Excel 2003
    Posts
    13

    re: array formula

    Shouldn't I just be able to change the index range to match the index tab in the formula wherever "Results Key" appears?

    Ie if there are 6 products in the results key tab shouldn't the formula read:

    =INDEX('Results Key'!$D$1:$D$6,SUMPRODUCT(SMALL(--('Results Key'!$B$1:$B$6<='Data Information'!$B$4)*IF('Data Information'!$B$5="",1,--('Results Key'!$C$1:$C$6='Data Information'!$B$5))*$A$3:$A$6,SUMPRODUCT(--('Results Key'!$B$1:$B$6<='Data Information'!$B$4)*IF('Data Information'!$B$5="",1,--('Results Key'!$C$1:$C$6='Data Information'!$B$5))-1)*-1+A3)))

  12. #12
    Forum Contributor
    Join Date
    03-12-2004
    Posts
    329

    re: array formula

    You can change the index range ('Results Key'!$D$1:$D$6), but arrays inside SUMPRODUCT() need to be the same size. ie. in your test5 file, "$B$1:$B$6", "$C$1:$C$6", and "$A$3:$A$23" must match.

  13. #13
    Registered User
    Join Date
    04-14-2009
    Location
    Chicago
    MS-Off Ver
    Excel 2003
    Posts
    13

    re: array formula

    So should it be A3:A8? That refers to the results page right? Or is it results key A1:A6? I think that's where the formula is messing up.

  14. #14
    Forum Contributor
    Join Date
    03-12-2004
    Posts
    329

    re: array formula

    Yes it should be A3:A8. Perhaps I had you confused when I put the "item#" in sheet3 (your Results Key sheet), that column is not used anywhere in the formula.

  15. #15
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    re: array formula

    Maybe a simpler approach with the ROW() idea you suggested and a key that makes the need for an array unnecessary. Have a look.
    Attached Files Attached Files

  16. #16
    Registered User
    Join Date
    04-14-2009
    Location
    Chicago
    MS-Off Ver
    Excel 2003
    Posts
    13

    re: array formula

    Both of these formulas are great. Morrigan was able to add it one step farther and allow for a 2nd filter which I love however I cannot for the life of me figure out how to add more items onto the table...

    Does anyone whow if there is there a function that allows the results to "push to as many rows as needed without being in each row?

    The new value is

    =INDEX('Results Key'!$D$1:$D$7,SUMPRODUCT(SMALL(--('Results Key'!$B$1:$B$7<='Data Information'!$B$4)*IF('Data Information'!$B$5="",1,--('Results Key'!$C$1:$C$7='Data Information'!$B$5))*$A$3:$A$3,SUMPRODUCT(--('Results Key'!$B$1:$B$7<='Data Information'!$B$4)*IF('Data Information'!$B$5="",1,--('Results Key'!$C$1:$C$7='Data Information'!$B$5))-1)*-1+A3)))
    Attached Files Attached Files
    Last edited by speedrcrwi; 04-16-2009 at 10:54 AM.

  17. #17
    Forum Contributor
    Join Date
    03-12-2004
    Posts
    329

    re: array formula

    Let's try again.
    Attached Files Attached Files

  18. #18
    Registered User
    Join Date
    04-14-2009
    Location
    Chicago
    MS-Off Ver
    Excel 2003
    Posts
    13

    re: array formula

    Seems to work now. What did I do wrong?

  19. #19
    Forum Contributor
    Join Date
    03-12-2004
    Posts
    329

    re: array formula

    I added another condition to the formula to look for blank spaces. As of now, the formula will see up to 100 items. Modify to suit your application, and of course larger the array longer it takes to finish the calculations.

  20. #20
    Registered User
    Join Date
    04-14-2009
    Location
    Chicago
    MS-Off Ver
    Excel 2003
    Posts
    13

    re: array formula

    Thank you so much for your assistance!

  21. #21
    Registered User
    Join Date
    04-14-2009
    Location
    Chicago
    MS-Off Ver
    Excel 2003
    Posts
    13

    re: array formula

    Sadly I need more assistance on this.....

    I showed the outcome to my peers and they came back with requested enhancements to "put it up a notch"

    I am not even sure if it can be done.... Ive attached the working SS.

    The enhancements I need to make are as follows:

    1) On the results tab, I need not only the description ( pulled from the results key tab) but also the cost as shown on the results key tab column E.

    2) I need to know if there is a way to include a new search function to exclude a wellness code or codes. Currently on Data information B5 the code narrows down to include only that code. Is there a way to do the reverse ie exclude only that code.

    Perhaps it would be easiest to have those codes pull a result onto a seperate tab which would then be the new results key.....

    3) Does anyone know if there is a form that would allow me to customize how the results tab looks?

    I know this is all pretty overbearing and possibly confusing so maybe we can tackle then one by one...


    Just as background, the wellness profile is the source data. This pulls to the results key to form an index which is narrowed down from the data information tab lines B4 and possibly B5. The end result is on the wellness results tab.

    Its a pretty neat workbook (Thanks again Morrigan!) that apparently needs to be "amped up".
    Attached Files Attached Files

  22. #22
    Forum Contributor
    Join Date
    03-12-2004
    Posts
    329

    re: array formula

    Try this, I had to add a helper column to make things simpler. You will have to do some formatting. As of now, it does not look very professional~


    HTH
    Attached Files Attached Files

  23. #23
    Registered User
    Join Date
    04-14-2009
    Location
    Chicago
    MS-Off Ver
    Excel 2003
    Posts
    13

    re: array formula

    I do have a question on your comment field on wellness results column C. You indicated that the cell will not work if the value is the same as another cell. Did you mean if the column B value matches another row that the system will not know what value to list?
    Last edited by speedrcrwi; 04-24-2009 at 03:38 PM.

  24. #24
    Forum Contributor
    Join Date
    03-12-2004
    Posts
    329

    Re: array formula

    If 2 entries in "Results Key" column D are the same, that formula will output the first one but not the second.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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