Home » excel » excel – Vlookup and sum one cell containing comma separated values

excel – Vlookup and sum one cell containing comma separated values

Posted by: admin May 14, 2020 Leave a comment


I have a table containing farm fields and acres contained in each field. The fields are owned jointly and split in percentages.

Field Splits Table:
Field Splits Table

Currently, I create a new row for each field and use a sumif for the acres contained in each field and then calculate what is owed by each individual for each field using another vlookup.

VLOOKUP(D19,$A$3:$F$15,4,FALSE)*F19 - to calculate BD Share ($)
VLOOKUP(D19,$A$3:$F$15,6,FALSE)*F19 - to calculate CK Share ($)

Invoice Splits Table:
Invoice Splits Table

I’ve found a VBA code to allow a user to select multiple values in a drop down list so that I could select multiple fields pertaining to a particular invoice and display them in one cell as a comma separated list. My question is whether I can sum the result of vlookup referencing multiple values in a comma separated list to calculate the appropriate invoice splits?

I’ve created a mock-up of what I’m trying to achieve based on the values shown in the Invoice Splits Table image. Is this even possible?

Invoice Splits Calculator Example:
Invoice Splits Calculator Example

How to&Answers:

Use this array formula:

=SUMPRODUCT(SUMIF($A$3:$A$15,,TRIM(MID(SUBSTITUTE(D19,",",REPT(" ",99)),(ROW($A$1:INDEX($A:$A,LEN(D19)-LEN(SUBSTITUTE(D19,",",""))+1))-1)*99+1,99)),$B$3:$B$15))

Being an array formula it needs to be confirmed with Ctrl-Shift-Enter instead of Enter when Exiting Edit mode.

for the VLOOKUP Just change the Sum column in the SUMIF:

=SUMPRODUCT(SUMIF($A$3:$A$15,,TRIM(MID(SUBSTITUTE(D19,",",REPT(" ",99)),(ROW($A$1:INDEX($A:$A,LEN(D19)-LEN(SUBSTITUTE(D19,",",""))+1))-1)*99+1,99)),$D$3:$D$15)) * F19


=SUMPRODUCT(SUMIF($A$3:$A$15,,TRIM(MID(SUBSTITUTE(D19,",",REPT(" ",99)),(ROW($A$1:INDEX($A:$A,LEN(D19)-LEN(SUBSTITUTE(D19,",",""))+1))-1)*99+1,99)),$F$3:$F$15)) * F19