Match, Index problem

TFranke

New Member
Joined
Aug 25, 2023
Messages
3
Office Version
  1. 365
  2. 2021
Platform
  1. MacOS
I came across this problema (i thought it was really simple when I started) and after a few days I realize I can't solve it myself.
Of course the actual spreadsheet is larger both in columns and in lines, but the problem remains the same:

Having a list of employees, whose salary is divided in different Credit and Debit accounts, I need to know for a specific individual, the ammounts that add up for certain account types.

In the example below, There are two Credit accounts named "Discount" I need a formula to add those up matching the Account type (Credit in this case) and the Employee Name, Employee 2 in this example.

Bear in mind that the actual sheet has hundreds of accounts and hundreds of employees.

If there isn't a simple way to address this problem, please suggest alternatives.

Thank you in advance!!

Salary Problem.xlsx
ABCD
1CreditDiscountDiscount
2DebitAccount 1: Salary
3Employee 1508032
4Employee 2203048
5
6
7Input Acct Type:Credit
8Input Acct NameDiscount
9Employee 278
Sheet1
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
Would something like this solve your question. I'm not sure if I understand how your larger data set works.

Mr excel questions 55.xlsm
ABCD
1CreditDiscountDiscount
2DebitAccount 1: Salary
3Employee 1508032
4Employee 2203048
5
6
7Input Acct Type:Credit
8Input Acct NameDiscount
9Employee 278
10
1178
TFranke
Cell Formulas
RangeFormula
C11C11=SUM(($B$1:$D$1=C8)*($A$3:$A$4=B9)*(B3:D4))
 
Upvote 0
Would something like this solve your question. I'm not sure if I understand how your larger data set works.

Mr excel questions 55.xlsm
ABCD
1CreditDiscountDiscount
2DebitAccount 1: Salary
3Employee 1508032
4Employee 2203048
5
6
7Input Acct Type:Credit
8Input Acct NameDiscount
9Employee 278
10
1178
TFranke
Cell Formulas
RangeFormula
C11C11=SUM(($B$1:$D$1=C8)*($A$3:$A$4=B9)*(B3:D4))
Thank you for your answer. Allow me to do some further explanation. In your solution, you are not taking into account that the account is a Credit Account. So what I am looking for is a formula that will add (for example in the spreadsheet I provided) all cells that have the "Discount" Account name, AND that such name is in the Credit line.

Using your answer I tried =SUM(($A$1:$A$2=C7)*($B$1:$D$1=C8)*($A$3:$A$4=B9)*(B3:D4)) but it doesn't seem to work (and I cannot make my head around why it doesnt work.)

Why do I need this to work this way? Because sin some cases, I will have for some columns, account names in both the credit and debit lines, and I need the corresponding values to end up in different places depending if they are credit or debits.
 
Upvote 0
The reason why it does not work is that you are trying to put a 1column x 2row maxtrix against a 3column x 2row matrix.
If you want to confirm in the calculation the first item in that row is "Credit" and then collect the columns with "Discount" that can be done like this.
BUT... I don't really see how it will help you repetitively as you will probably need to adjust the formula references constantly.

Just as a side note. Are you receiving your data in a file like this, or are you inputting this manually into a worksheet to then do the calculations?
The reason why I ask, is that there is probably a better way to aggregate your data and then do your reporting on a separate worksheet (but that is my pet peeve to never (or least not intersperse) manipulations of data within raw data.

Book2
ABCD
1CreditDiscountDiscount
2DebitAccount 1: Salary
3Employee 1508032
4Employee 2203048
5
6
7Input Acct Type:Credit
8Input Acct NameDiscount
9Employee 278
10
11orig suggestion78=SUM(($B$1:$D$1=C8)*($A$3:$A$4=B9)*(B3:D4))
12your formula0=SUM(($A$1:$A$2=C7)*($B$1:$D$1=C8)*($A$3:$A$4=B9)*(B3:D4))
13updated suggestion78=SUM(($A$1=C7)*($B$1:$D$1=C8)*($A$3:$A$4=B9)*(B3:D4))
Sheet1
Cell Formulas
RangeFormula
C11C11=SUM(($B$1:$D$1=C8)*($A$3:$A$4=B9)*(B3:D4))
D11:D13D11=FORMULATEXT(C11)
C12C12=SUM(($A$1:$A$2=C7)*($B$1:$D$1=C8)*($A$3:$A$4=B9)*(B3:D4))
C13C13=SUM(($A$1=C7)*($B$1:$D$1=C8)*($A$3:$A$4=B9)*(B3:D4))
 
Upvote 1
Solution
Thank you very much! with this information I re-arranged my information and solved the problem using your formula.

Thank you!!!
 
Upvote 0
My pleasure. I am happy found a solution at this forum.

Best wishes!
 
Upvote 0

Forum statistics

Threads
1,223,227
Messages
6,170,849
Members
452,361
Latest member
d3ad3y3

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