Compare Customers

gebo84

Board Regular
Joined
Nov 6, 2014
Messages
96
Office Version
  1. 365
Platform
  1. Windows
Hi,

i have two tables which are sorted by our top spending customers, each table for a different financial year.
i want to be able to compare the two tables by having some sort of formula look for the customer in both tables and compare their spend by +/-
for example,

i want Company X in column E to look for the same company in column A then do a calculation from their spends which are in columns F & B respectively, then to return a value of +/-

is this possible?
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
Put your two table ranges in the first VSTACK function in the formula below

Excel Formula:
=LET(x,VSTACK(A2:B4,E2:F4),u,UNIQUE(INDEX(x,,1)),SORT(HSTACK(u,DROP(REDUCE("",u,LAMBDA(a,b,VSTACK(a,SUM(FILTER(INDEX(x,,2),INDEX(x,,1)=b))))),1)),2,-1))
 
Last edited:
Upvote 0
Put your two table ranges in the first VSTACK function in the formula below

Excel Formula:
=LET(x,VSTACK(A2:B4,E2:F4),u,UNIQUE(INDEX(x,,1)),SORT(HSTACK(u,DROP(REDUCE("",u,LAMBDA(a,b,VSTACK(a,SUM(FILTER(INDEX(x,,2),INDEX(x,,1)=b))))),1)),2,-1))
Hi,

thank you! it almost works, the final result seems to be adding the two values together rather than minus one from the other
 
Upvote 0
Could you post sample data? Using XL2BB
 
Upvote 0
Sorry i cant get that to work,
i've posted an image to show you the sheet. Column I is where the current formula is returning the values
 

Attachments

  • 2023-01-25 11_48_53-Window.png
    2023-01-25 11_48_53-Window.png
    104.3 KB · Views: 9
Upvote 0
Do you want to subtract col F from col B?
 
Upvote 0
Ok, how about
Excel Formula:
=LET(v,VSTACK(A6:A100,E6:E100),u,UNIQUE(FILTER(v,v<>"")),SORT(HSTACK(u,SUMIFS(B:B,A:A,u)-SUMIFS(F:F,E:E,u))))
 
Upvote 0
Solution
Glad we could help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,214,973
Messages
6,122,534
Members
449,088
Latest member
RandomExceller01

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