Dec 05 2023 12:58 AM - edited Dec 05 2023 12:58 AM
How can get the desired result as presented in the workbook without using the pivot table.
I want the combined positive values in one cell and combined negative values in another cell.
Dec 05 2023 02:29 AM - edited Dec 05 2023 02:35 AM
Welcome to your Excel discussion space! asks to provide some info. like Excel version...
Assumed you run Excel 2021 or 365:
in D3
=SORT( UNIQUE(Table1[Particulars]) )
in E3
=SUMIF(Table1[Particulars], D3#, Table1[Amount])
EDIT: Forgot the totals of Positives & Negatives. See in attached file
Dec 05 2023 02:56 AM - edited Dec 05 2023 03:00 AM
Thank you so much for replying.
As I can see, you have removed the need for pivot table but what I need is a single formula to be applied directly to the table in order to get the results in E8 & E9. Can you help me with that that formula??
Also, using Microsoft 365
Thanking in advance.
Dec 05 2023 03:22 AM
Solution
in D8 (make sure E8, D9 & E9 contain nothing):
=LET(
particulars, UNIQUE(Table1[Particulars]),
amounts, SUMIF(Table1[Particulars], particulars, Table1[Amount]),
positives, SUM( IF(amounts >= 0, amounts) ),
negatives, SUM( IF(amounts < 0, amounts) ),
HSTACK(
{"Positives";"Negatives"},
VSTACK(positives, negatives)
)
)
Dec 05 2023 03:28 AM
Dec 05 2023 03:30 AM
Dec 05 2023 04:31 AM
On reflection:
=LET(
amounts, SUMIF(Table1[Particulars], UNIQUE(Table1[Particulars]), Table1[Amount]),
positives, SUM( IF(amounts >= 0, amounts) ),
HSTACK(
{"Positives";"Negatives"},
VSTACK(positives, -positives + SUM(amounts))
)
)
Dec 05 2023 05:20 AM
Dec 05 2023 06:27 AM
I want to convert the result into millions, i.e., to divide the results by 100000. That would be:
SUMIF(Table1[Particulars], UNIQUE(Table1[Particulars]), Table1[Amount]) / 10^5
or I misunderstood something?
Dec 05 2023 08:32 AM
Dec 05 2023 09:13 AM - edited Dec 05 2023 11:00 AM
@KunalGoel9911 See attached file
Dec 05 2023 10:57 PM
Dec 07 2023 12:29 AM
Sounds like a never ending story 🙂 Instead of text could you please upload a representative sample of your data + the expected result? Thanks
Dec 05 2023 03:22 AM
Solution
in D8 (make sure E8, D9 & E9 contain nothing):
=LET(
particulars, UNIQUE(Table1[Particulars]),
amounts, SUMIF(Table1[Particulars], particulars, Table1[Amount]),
positives, SUM( IF(amounts >= 0, amounts) ),
negatives, SUM( IF(amounts < 0, amounts) ),
HSTACK(
{"Positives";"Negatives"},
VSTACK(positives, negatives)
)
)