ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   SUMPRODUCT function for two arrays. Array 1 contains text (https://www.excelbanter.com/excel-worksheet-functions/191846-sumproduct-function-two-arrays-array-1-contains-text.html)

Payal

SUMPRODUCT function for two arrays. Array 1 contains text
 
i have one array A2 to A10 containing text (A+/A/B/C). another array C2 to
C10 contains numbers (0/1). i want to multiply each element of one array with
another, replacing A+ for 2, A for 1.5, B for 1 and C for .5. Example:
A B C
----------------------
A 0
A+ 1
B 0
C 1
...........................
it should give me the result: 2.5 [(replace A by 1.5*0) + (replace A+ by
2*1) + (replace B by 1*0) + (replace C by .5*1)]

Please help me with this..

Regards


Rick Rothstein \(MVP - VB\)[_718_]

SUMPRODUCT function for two arrays. Array 1 contains text
 
Either of these two array-entered** formulas seem to do what you want...

=SUM(B2:B10*IF(A2:A10="",0,2.5-MATCH(A2:A10,{"A+","A","B","C"},0)/2))

=SUM(B2:B10*IF(A2:A10="",0,LOOKUP(A2:A10,{"A","A+" ,"B","C"},{1.5,2,1,0.5})))

** Commit the formula by using Ctrl+Shift+Enter, not just Enter by itself.

Rick


"Payal" wrote in message
...
i have one array A2 to A10 containing text (A+/A/B/C). another array C2 to
C10 contains numbers (0/1). i want to multiply each element of one array
with
another, replacing A+ for 2, A for 1.5, B for 1 and C for .5. Example:
A B C
----------------------
A 0
A+ 1
B 0
C 1
..........................
it should give me the result: 2.5 [(replace A by 1.5*0) + (replace A+ by
2*1) + (replace B by 1*0) + (replace C by .5*1)]

Please help me with this..

Regards




All times are GMT +1. The time now is 08:45 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com