Sum up Key Value Pairs and Concatenate Results

Problem description & analysis

Here is an Excel file Book1.xlsx:

A

B

C

D

1

Col1

Col2

Col3

Col4

2

350

mac

360

jan

3

500

jan

200

mac

Odd-numbered columns contain values and even-numbered columns contain names. We are trying to sum values for each name and output results beginning from, say, row 5, as shown below:

A

B

C

D

1

Col1

Col2

Col3

Col4

2

350

mac

360

jan

3

500

jan

200

mac

4

5

jan

860

6

mac

550

Solution & explanation

First, we load add-in ExcelRaq.xll and macro file esproc_template.xla to Excel, and then

Select cell A5 and enter the following formula in it: =esprocT("=?1.conj(~.group((#-1)\2)).groups(~(2);sum(~(1)))",A2:D3), press Ctrl+Enter, and drag A5 down to A6 to get results.

Q & A Collection

https://stackoverflow.com/questions/63588908/sum-up-numeric-lead-part-of-strings