Sum array with some criteria problem

sasa_z

New Member
Joined
May 18, 2018
Messages
9
I have Sheet1 and Sheet2.

Sheet1
employeeID (c column)JobID (d column)result
231

<tbody>
</tbody>

Sheet2 (named CSV1)

employeeID (A column)JobID (D column))payment1 (X column)payment2 (BM column)
23133343454

<tbody>
</tbody>

In Result column on sheet1 I want to have sum of columns (payment1,payment2) where values employeeID and JobID are the same in both sheets.

I tried this {=SUM(IF($C5='CSV1'!$A$2:$A$151,$D5='CSV1'!$H$2:$H$151)*('CSV1'!$X$2:$X$151+'CSV1'!$BM$2:$BM$151))} and it worked but when some rows are deleted formula got #ref ! error so I decided to use offset as well
{=SUM(IF(OFFSET($A$1,ROW()-ROW($B$1),1)='CSV1'!$A$2:$A$151,OFFSET($A$1,ROW()-ROW($B$1),2)='CSV1'!$H$2:$H$151)*('CSV1'!$X$2:$X$151+'CSV1'!$BM$2:$BM$151))}

and got #ref ! error with "a value used is of the wrong data type

Any help appreciated
 
YOu mean not to use offset? I don't know any other way to resolve an issue when some rows or cells are deleted in C,D columns.
 
Upvote 0

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
YOu mean not to use offset? I don't know any other way to resolve an issue when some rows or cells are deleted in C,D columns.

Yes, I mean that. And before proceeding on adding and deleting rows, try to explain what happens with the formula you are already given?
 
Upvote 0
I got REF! errors. Try to delete some cells in C and D columns on sheet1 and you will get the same error.
 
Upvote 0
Yes, it works with your worksheet (don't know the reason why not working on my worksheet). I had working formula before I started this post as I stated. It is a little different from yours but it was working. My main goal was to add offset to resolve issue with formula when some cells are deleted. Ty
 
Upvote 0
First things first.

Try to figure out why the formula does not succeed in your spreadsheet. Once that's cleared up, I'll proceed to the "delete/add" issue.
 
Upvote 0

Forum statistics

Threads
1,216,788
Messages
6,132,701
Members
449,753
Latest member
swastikExcel

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