+ Reply to Thread
Results 1 to 9 of 9

Conditionally divide two arrays

  1. #1
    Registered User
    Join Date
    05-22-2019
    Location
    London, England
    MS-Off Ver
    Office 365
    Posts
    9

    Conditionally divide two arrays

    Dear Forum,

    I have the following issue. I would like to conditionally divide two arrays by one another and sum the result. In the example below, I want to divide row 2 by row 4 but only if the word in row 1 appears in row 3. Here, this yields: 1) divide cell A2 by B4 (because both have the mathcing word "word1") which gives 2 and divide cell C2 by C4 (both have the matching word "word3") which gives 3. 2) Sum the result which gives 5.

    Thank you very much for your help! very appreaciated!
    Best regards


    a b c d e f
    1 Word1 Word2 Word3 Word4 Word5 Word6
    2 10 13 18 15 11 19
    3 Word8 Word1 Word3 Word9
    4 5 5 4 4
    Last edited by Mag2; 06-06-2019 at 05:45 AM.

  2. #2
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    25,408

    Re: Conditionally divide two arrays

    Are the columns paired together, so the word in A1 could appear either in A3 or B3, and the word in C1 could appear in either C3 or D3 ?

    Pete

  3. #3
    Registered User
    Join Date
    05-22-2019
    Location
    London, England
    MS-Off Ver
    Office 365
    Posts
    9

    Re: Conditionally divide two arrays

    Hi Pete,

    thanks for your reply!
    In fact, the word could appear anywhere in row 3, also in E3

    Best regards

  4. #4
    Registered User
    Join Date
    05-22-2019
    Location
    London, England
    MS-Off Ver
    Office 365
    Posts
    9

    Re: Conditionally divide two arrays

    Hi,
    does anyone have an answer? It works for multiplication: SUMPRODUCT(SUMIFS(A2:F2;A1:F1;A3:F3)) but I do not know how to set it up for divison. Can anyone help, please?
    All the best,
    Mag2

  5. #5
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2502
    Posts
    13,700

    Re: Conditionally divide two arrays

    (both have the matching word "word3") which gives 3. 2)
    Word3 has 18 in A2:F2 and 4 in A4:F4. 18/4 = 4.5 which would result in sum({10;18}/{5;4}) = sum({2;4.5}) = 6.5

    If that is not what you expect I will need additional detail.

    In the meantime this cumbersome beast returns 6.5 and references a helper cell H1.
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Then this array entered. (Perhaps this can be shortened but I want to be clear on the concept first.)

    If you aren’t familiar with array-entered formulas array enter means the formula must be committed from edit mode by simultaneously pressing and holding down Ctrl and Shift while hitting Enter.

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    This all depends upon the numbers being sorted ascending which is not going to be the case I'm sure.
    Last edited by FlameRetired; 06-06-2019 at 02:24 PM.
    Dave

  6. #6
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2502
    Posts
    13,700

    Re: Conditionally divide two arrays

    Removed by FR.
    Last edited by FlameRetired; 06-06-2019 at 05:44 PM.

  7. #7
    Registered User
    Join Date
    05-22-2019
    Location
    London, England
    MS-Off Ver
    Office 365
    Posts
    9

    Re: Conditionally divide two arrays

    Hi FlameRetired,
    yes this beast works the way it shoudl! You helped me a lot!
    All the best,
    Magnus

  8. #8
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Conditionally divide two arrays

    Am I missing something or can you just use:

    =SUM(IFERROR(A2:F2/SUMIF(A3:D3,A1:F1,A4:D4),0))

    with CSE?

    Regards
    Click * below if this answer helped

    Advanced Excel Techniques: http://excelxor.com/

  9. #9
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2502
    Posts
    13,700

    Re: Conditionally divide two arrays

    Yup! Much better!!

+ 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. Replies: 1
    Last Post: 01-04-2017, 06:00 PM
  2. Replies: 1
    Last Post: 01-04-2017, 05:59 PM
  3. storing multiple value in a single cell (through arrays or without arrays)?
    By mak51061 in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 12-25-2014, 09:27 PM
  4. Declaring multiple multi-dimensional arrays (jagged arrays) - compile error?
    By dfribush in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 12-20-2013, 05:06 PM
  5. vba compare arrays and remove exact matching arrays
    By jacojvv in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 10-25-2013, 07:30 AM
  6. [SOLVED] New to arrays-where do I find a good beginners guide to multi dimensional arrays
    By mc84excel in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 06-04-2013, 07:44 PM
  7. Conditionally positioning arrays
    By dbryant99 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 09-24-2009, 06:03 PM

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