Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Excel Array formula Help

Posted on 2016-08-12
11
Medium Priority
?
69 Views
Last Modified: 2016-08-12
I need  formula that will multiply every value of cells type A by cells type B, in a range, then return the sum of all the results
Results should be: 123*23 + 432*12 +2*10
I need as an array or regular formula and not as a vb.script, purpose is for use to be able to insert rows freely and keep the operation working.

I attach image of expected resultimage for excel array formula
0
Comment
Question by:arana
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
  • 2
11 Comments
 
LVL 43

Expert Comment

by:Saqib Husain, Syed
ID: 41754288
Try something like

=SUMPRODUCT(C5:C14*C6:C15)
0
 
LVL 11

Author Comment

by:arana
ID: 41754290
Nice one , that works for example data, but doesnt follow any criteria, if I enter any other value in between it gives wrong result ,  original data has many other rows in between , that is why I specified the A and B types, i am trying something like "  =MMULT(IF(B5:B6="A",C5:C15,1),IF(B5:B15="B",C5:C15,1))"  
but cannot make it work.
0
 
LVL 32

Accepted Solution

by:
Subodh Tiwari (Neeraj) earned 2000 total points
ID: 41754296
Assuming your data is in the range B5:C13, the you may try the following Array formula...

=SUM(IF(B5:B12="A",C5:C12)*IF(B6:B13="B",C6:C13))

Open in new window

0
Office 365 Training for IT Pros

Learn how to provision tenants, synchronize on-premise Active Directory, implement Single Sign-On, customize Office deployment, and protect your organization with eDiscovery and DLP policies.  Only from Platform Scholar.

 
LVL 11

Author Comment

by:arana
ID: 41754299
PERFECT, now can you elaborate in why the second if must start on element below the first one if they are both refering to same data?, I mean c6:c13 contains c12 as well as as most of the first IF data, is it mandatory that the first element of the array matches the condition ?
0
 
LVL 32

Expert Comment

by:Subodh Tiwari (Neeraj)
ID: 41754306
Because the second criteria starts from one row below where the first criteria exists. If you specify the same ranges within the both IF formulas, that will be evaluated as False in all the cases i.e. when B5 is "A", B5 will never be equal to a "B" and if you breakup the formula, you will get a 0 as False * False returns a 0.

Hope you get it. :)
0
 
LVL 43

Expert Comment

by:Saqib Husain, Syed
ID: 41754307
Nice one , that works for example data, but doesnt follow any criteria,
Experts are here to help you. You could help them by providing data which does represent your case. You cannot expect others to read your mind.

You can also help by uploading an excel file instead of an image to save some typing.
0
 
LVL 11

Author Comment

by:arana
ID: 41754311
@saqib, you dont need to read my mind, if im explicitly requiring that type A and B should be considered in the results, that means no other data should influence the result.
0
 
LVL 43

Expert Comment

by:Saqib Husain, Syed
ID: 41754312
Non Array formula

=SUMPRODUCT((B5:B14="A")*C5:C14*C6:C15)
1
 
LVL 43

Expert Comment

by:Saqib Husain, Syed
ID: 41754337
The criteria followed by the formulas is not

"multiply every value of cells type A by cells type B"

it is

"multiply every value of cells type A by the cells below"
0
 
LVL 11

Author Comment

by:arana
ID: 41754350
No it isn't what you want it to be, it is what I asked  , i need the one i specified, i have type c and type d also, those are not relevant since I'm specifically asking for type A and B, and also that I should be able to add more rows without it breaking things, so see , you don't need to read minds, but you need to read the original question.
0
 
LVL 43

Expert Comment

by:Saqib Husain, Syed
ID: 41754363
Unless B is on the NEXT line the formula fails. So looking for B is not relevant as you can see on my last formula which works equally.

As soon as b is not on the NEXT line every thing breaks.

Try it.
0

Featured Post

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
Outlook for dependable use in a very small business   This article is about using the Outlook application (part of Microsoft Office) in a very small business, or for homeowners where dependability and reliability are critical requirements. This …
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

721 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question