Excel Index Match Sumifs - excel

I have a table of data where column headers are account numbers, and I'm trying to sum all data for a specified account when one column (left hand column) equals a certain number.
724| 453 | 345
1 90 0 2
2 91 1 3
3 80 5 4
So would like a formula that would sum account 453, or 345 if values in first column are less than 2. I've written an index/match function to find the column for a specified fund. But can't seem to add in the sumif or sumifs to help sum. if there is a better way, please help.

Related

How to write a multiple criteria index-match that averages all occurrences of results

I am trying to find the average of all occurrences in column C based on an index-match search of column A and B.
Here is the example data:
A B C
1 10 85
1 10 80
2 20 83
2 20 75
Currently, my function is this
=AVERAGE(INDEX(C2:C5,MATCH(1&10,A2:A5&B2:B5,0)))
This produces the value 85. I would like to take the average of both 85 and 80.
Thank you!
Looks like typically a case for AVERAGEIFS(), average a specific column with certain criteria in other columns e.g. your 1 in column A and 10 in column B.
So try:
=AVERAGEIFS(C1:C5,A1:A5,1,B1:B5,10)

Sum row in Excel/Google Sheets based on Condition

It seems like this question should exist somewhere, but I can't seem to find it...exactly.
The most similar solution I can find requires the use of SUMIFS or SUMIF, which only seems to add up numbers in a column, not spanning multiple columns. Here's an example sheet with 2 rows:
A B C D E F G H ...
1 2015-01-01 0 1 6 12 45 12 5 ...
2 2016-01-01 256 43 13 35 134 135 12 ...
Now I'd like to have a cell somewhere that adds all of the cells in the row for 2015-01-01. My attempt looks like:
SUMIF(A1:A30,"2015-01-01", B1:BJ30)
But this only yields the sum of the column B, so 0 for the exact formula above or 256 if I were to do this for the year 2016.
When trying something with SUMIFS, I'm told that the criterion range's size should match the sum range size, which isn't the case because my criterion range is only the first column of dates.
How can I add all the values in a row if the first cell's date matches my criterion? It may be worthwhile to note that this is in Google Sheets, not Excel.
In both excel and googlesheets you can use a SUMPRODUCT, for example:
=SUMPRODUCT((A1:A30 = DATE(2015, 1, 1)) * B1:BJ30)
You can try either of these:
=if(A1=date(2015,1,1),sum(B1:F1),"")
=if(A1=A1,sum(B1:F1),"")

Excel Find Value next to max value

If I do a simple formula such as
=MAX(J:J)
and I have a table such as
1 2
2 10
3 45
4 1
5 144
I would expect to see my cell = 144
is there a way for me to get the result 5 (as in the column to the left of the max?)
So if you want the value from column I try this formula
=INDEX(I:I,MATCH(MAX(J:J),J:J,0))
MATCH finds the relevant row number then INDEX gives you the value in column I from that same row

Sum the values in Excel cells depending on changing criteria

In an Excel spread sheet I have three columns of data, the first column A is a unique identifier. Column B is a number and column C is either a tick or a space:
A B C
1 d-45 150 √
2 d-46 200
3 d-45 80
4 d-46 20 √
5 d-45 70 √
Now, I wish to sum the values in column B depending on a tick being present and also relative to the unique ID in column A. In this case rows 1 and 5. Identifying the tick I use
=IF(ISTEXT(C1),CONCATENATE(A1))
&
=IF(ISTEXT(C1),CONCATENATE(B1)).
This leaves me with two arrays of data:
D E
1 d-45 150
4 d-46 20
5 d-45 70
I now want to sum the values in column E depending on the ID in column D, in this case row 1 and 5. I can use a straight forward SUMIFS statement to specify d-45 as the criteria however this unique ID will always change. Is there a variation of SUMIFS I can use?
I also wish to put each new variation of ID number into a separate header with the summed totals underneath, that is:
A B
1 d-45 d-46
2 220 20
etc...
You can try this:
To get the distinct ID's write (in H1 then copy right):
This one is an array formula so you need Ctrl Shift Enter to enter the formula
=INDEX($A$1:$A$5;SMALL(IF(ROW($A$1:$A$5)-ROW($A$1)+1=MATCH($A$1:$A$5;$A$1:$A$5;0);ROW($A$1:$A$5)-ROW($A$1)+1;"");COLUMNS($A$1:A1)))
Now to get the sum (H2 and copy right)
=SUMPRODUCT(($A$1:$A$5=H1)*ISTEXT($C$1:$C$5)*$B$1:$B$5)
Data in the example is in A1:C5
Depending on your regional settings you may need to replace ";" field separator by ","
Try this,
SUMIFS
=SUMIFS(B1:B5,A1:A5,"=d-45",C1:C5,"<>")
where "<>" means that the cell is not empty...

VBA to add missing numbers in a column and add a zero in next to it in column B

Can anyone write a code for the following task.
I have a series of numbers in column A and an associated value in column B.
e.g
A B
1 144
2 33
5 4
6 56
8 1
I need to run a macro that add in the missing consecutive numbers in column A and adds an associated zero value in column b.
e.g
1 144
2 33
3 0
4 0
5 4
6 56
7 0
8 1
can anyone help
If you can present the information on a different sheet, you don't need vba.
On the 2nd sheet, put your numbers in column A, using autofill to get the progression, or use =A1+1 as a formula to create the progression.
in column B, use =IFERROR(VLOOKUP(A1,Sheet1!$A$1:$B$5000,2,FALSE),0) to find the number, or to put 0 if no number is found
(use =IF(ISERROR(VLOOKUP(A1,Sheet1!$A$2:$B$5,2,FALSE)),0,VLOOKUP(A1,Sheet1!$A$2:$B$5,2,FALSE)) if your version of excel does not support ISERORR)

Resources