Adding values based on varying length arrays

davidlamb12

New Member
Joined
Feb 25, 2011
Messages
2
Hi, I'm a bit stumped on how to approach an issue. I have a spreadsheet with about 3000 lines and I need to add values in one column based on the identifier in a previous column (the spreadsheet updates weekly, so the number of identifiers changes every week).

So, in tab #1, I have a list of numbered systems 0-500 of which I need to add figures from Tab #2.

In Tab #2, column A, I have system numbers (in random order) from 0-500 with multiple redunancies (and sometimes missing).

In Tab #2, Column C, I have figures that need to be added based on the system number.

For example, I want to add the numbers for system #1 (which is in Row 5 of Tab #1), I then want to add all the figures in tab #2, Column C that correspond to the rows where the number "1" appears in tab #2, Column A. (which may be in tab #2, rows 5, 2000, and 2310)

Functions like H/VLOOKUP will return one corresponding value, but not all of them.

Any help would be appreciated. Thank you!:confused:
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
Perfect, thank you.

As a followup. I also want to count the number of instances of 2 different criteria in 2 different columns. I can't see how COUNTIF will work for me.

So if "Column A" value and "Column D" match specific criteria, I want to count the instance.

So if "Column A" = "X" and "Column D" = "5", I want to count the instances. However, if "Column A" = "X" and "Column D" = "4", I don't want to count it. Again, I don't know the number of rows, so nested "if" loops won't work. How would I attack nested COUNTIF's?

Thanks!
 
Last edited:
Upvote 0
Perfect, thank you.

As a followup. I also want to count the number of instances of 2 different criteria in 2 different columns. I can't see how COUNTIF will work for me.

So if "Column A" value and "Column D" match specific criteria, I want to count the instance.

So if "Column A" = "X" and "Column D" = "5", I want to count the instances. However, if "Column A" = "X" and "Column D" = "4", I don't want to count it. Again, I don't know the number of rows, so nested "if" loops won't work. How would I attack nested COUNTIF's?

Thanks!
Try one of these...

Use cells to hold the criteria:
  • F1 = X
  • G1 = 5
This formula will work in any version of Excel:

=SUMPRODUCT(--(A2:A10=F1),--(D2:D10=G1))

This formula will only work in Excel 2007 and later:

=COUNTIFS(A2:A10,F1,D2:D10,G1)
 
Upvote 0

Forum statistics

Threads
1,224,521
Messages
6,179,285
Members
452,902
Latest member
Knuddeluff

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