Hstack Problem

pto160

Active Member
Joined
Feb 1, 2009
Messages
478
Office Version
  1. 365
Platform
  1. Windows
I am trying to add an extra column using the Hstack function. The third column I need to use a Text join using the delimiter ":" for the refunds who are duplicate customers and the other ones just the single refund. Here is the data.

Book1
ABC
1NameAmountVoucher
2John Smith5010020
3Paul Rudd10010021
4John Smith20010022
5Jane Smith50010023
6
7=HSTACK(UNIQUE(A2:A5),SUMIFS(B2:B5,A2:A5,UNIQUE(A2:A5)))
8
9What I want:
10NameAmountVoucher
11John Smith25010020:10022
12Paul Rudd10010021
13Jane Smith50010023
Sheet1
 
These are great formulas. With the reduce formula,
Excel Formula:
=REDUCE(A1:C1,A2:A5,LAMBDA(x,y,IF(OR(y=x),x,VSTACK(x,HSTACK(y,SUMIF(A:A,y,B:B),TEXTJOIN(":",,FILTER(C:C,A:A=y)))))))
I have an extra column for ID, that I would doing the sum criteria on instead of name but I would like to see both name and ID.
How would I add the extra column? The reduce formula is accounting for 3 columns- Name, Amount and Voucher.

Book2
ABCD
1Cust IDNameAmountVoucher
2100John Smith5010020
3200Paul Rudd10010021
4100John Smith20010022
5300Jane Smith50010023
6
7
8What I would like
9Cust IDNameAmountVoucher
10100John Smith250.0010020:10022
11200Paul Rudd100.0010021
12300Jane Smith500.0010023
Sheet1
 
Upvote 0

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.

Forum statistics

Threads
1,214,827
Messages
6,121,812
Members
449,048
Latest member
greyangel23

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top