Excel countif or if - excel

Tried doing this a few ways and I think I'm just looking at this a little too complicated.
I have column a with several different names that repeat. I have column B with dollar amounts. I'm trying to get a formula that will add the totals amount for a specific person.
JOHN $17.23
JAMES $37.52
JOHN $14.23
JAMES $27.52
APRIL $32.00
APRIL $143.20
JOHN $90.27
JOHN $81.13
JOHN = Total for John
JAMES = Total for James
APRIL = Total for April
Thank you

Assuming this table
A B
1 Names Bill
2 John 10
3 Tom 20
4 John 4
5 Tom 3
To get the total for each name you can write
A B
7 Names Total
8 John =Sumif(A2:A5;A8;B2:B5)
9 Tom =Sumif(A2:A5;A9;B2:B5)
This will sum up each value for the given area.

Consider:
=SUMPRODUCT((A$1:A$8="John")*(B$1:B$8))
=SUMPRODUCT((A$1:A$8="James")*(B$1:B$8))
=SUMPRODUCT((A$1:A$8="April")*(B$1:B$8))

Striking my original response in favor of:
=SUMIF(B3:B10,"=JOHN",C3:C10) I tested that, and it works even better

Related

EXCEL Get top 3 largest numbers in repetitive array

enter image description hereI have an array of people with scores in other column. I need to find top 3 people with highest score and print their names.
Example:
Maria 1
Thomas 4
John 3
Jack 2
Ray 2
Laura 4
Kate 3
Result should be:
Thomas
Laura
John
What I get:
Thomas
Thomas
John
What I get:
Thomas
John
num
I have tried using LARGE, MATCH, MIN, MAX but nothings works.
My first failure code:
=INDEX($A$2:$A$8; MATCH(LARGE(($B$2:$B$8);{1;2;3}); $B$2:$B$8;0))
My second failure code:
{=INDEX($A$2:$A$14;SMALL(IF($B$2:$B$14=MAX($B$2:$B$14);ROW($B$2:$B$14)-1);ROW(B4)-1))}
Put this in the second row of the column you want:
=INDEX(A:A,AGGREGATE(15,7,ROW($B$1:$B$7)/((COUNTIF($D$1:D1,$A$1:$A$7)=0)*($B$1:$B$7=LARGE(B:B,ROW(1:1)))),1))
And drag down three rows:

Excel INDEX MATCH when one of multiple criteria is within a range of numbers

To identify duplicates in a large list of personal records, I'm replacing all names with a CONCATENATE of Name and Date of Birth (DOB). Here is the sheet I'm referencing (DOBs!):
DOBs! -----------------------------------------
C D E F G I K
Name Years Start End # Yrs DOB NewNameDOB
Sally Adams 2014-2014 2014 2014 1 1968-1204 Sally Adams1968-1204
John Agnew 2014-2014 2014 2014 1 1979-0419 John Agnew1979-0419
Bob Anderson 2013-2014 2013 2014 2 1965-0402 Bob Anderson1965-0402
Antonio Andrews 2014-2014 2014 2014 1 1955-0716 Antonio Andrews1955-0716
Julie Assan 2012-2014 2012 2014 3 1978-0805 Julie Assan1978-0805
On the main sheet (Employees!), each person has a row of data for each active year. Work 14 years, you have 14 lines of data to track.
Employees! -----------------------------------------
C D **E** F G H I J...
Year Name NewNameDOB Dept
2013 Julie Assan Julie Assan1978-0805 East
1998 Mike Rogers Duplicate in Same Year Main
1999 Mike Rogers Duplicate in Same Year Main
2000 Mike Rogers Mike Rogers1969-0510 Main
2001 Mike Rogers Mike Rogers1969-0510 Main
As mentioned, I need to separate duplicate names from 10395 records (like Mike Rogers and Mike Rogers). Employees! column E will now identify the employees as Julie Assan1978-0805 and Julie Assan1980-0131 (for example).
Today we take my first step, using the years they worked in order to solve 99% of the duplicates. After this, only a few duplicate names will be left who worked at the same time as each other, which I'll have to handle manually.
If the Employees! sheet has a 2013 record for "Julie Assan," then the first step is to check DOBs to find any Julie Assans who worked in 2013. My new column E in Employees! will take the current 2013 record of Julie Assan, and find any matches in DOB! where C (name) matches Julie Assan, E <= 2013, and F >= 2013. Usually, there will be only one match, and it will tell me that is Julie Assan1978-0805. Sometimes, there will be two Mike Rogers who worked during the same year, and it should tell me "Duplicate in Same Year".
On the Employees! sheet column E, I've started with this...
=index(DOBs!$k$2:$k$10395,match($d3&$c3,DOBs!$c$2:$c$10395& ??? ,0)
Not sure where to go with this formula, whether that means adding "IFs" or something different.
edited to explain in great depth
=IF(COUNTIFS(DOBs!C$2:C$10395,Employees!D2,DOBs!E$2:E$10395,"<="&Employees!C2,DOBs!F$2:F$10395,">="&Employees!C2)>1,"Duplicate in Same Year",INDEX(DOBs!K$2:K$10395,MATCH(TRUE,IF(DOBs!C$2:C$10395=Employees!D2,IF(DOBs!E$2:E$10395<=Employees!C2,IF(DOBs!F$2:F$10395>=Employees!C2,TRUE))),0)))
Enter as an array formula by confirming with Ctrl+Shift+Enter, then autofill down. It first checks for duplicates using COUNTIFS, and returns "Duplicate in same year" if it is. If there are not duplicates, it uses INDEX/MATCH to find the NewNameDOB.

Summing rows of values conditionally in Excel / Google Sheets

I have a spreadsheet that looks like this:
NAME HOURS ESTIMATED FOR TASK
================================
Bob 7
Jim 6
Bob 1
Sue 10
What I want to be able to do is to sum the total number of hours that each worker will have to spend on all tasks:
NAME HOURS ESTIMATED FOR TASK
================================
Bob 7
Jim 6
Bob 1
Sue 10
TOTALS
Bob 8
Jim 6
Sue 10
I assume that I would combine some kind of HLOOKUP and SUMIF to complete the TOTALS section, but I'm not sure. How would I complete this kind of summation?
Maybe:
=query(A2:B5,"select A, sum(B) group by A ")

Unique numbering of unsorted sets

Is there a way to make this
---A---
John
John
Tim
steve
John
-------
into this:
-----A--------B------
John 1
John 1
Tim 2
Steve 3
John 1
---------------------
Have a large data file with duplicate names, and would like to number them in the way mentioned in order to use them in another way.
Please try:
=IF(COUNTIF(A$1:A2,A2)=1,MAX(B$1:B1)+1,VLOOKUP(A2,A$1:B1,2,0))
in B2 copied down, with labels or blanks in Row1.

How to accumulate text cells

Is it possible in Excel 2010 to have a function that finds duplicates in a column range and based on the number of duplicates, then accumulates the equal range into one cell?
This is how my data looks:
Family Name Age Postcode
Doe John 40 1400
Doe Jane 35 1400
Doe Baby 5 1400
Mark Peter 14 1600
Matt Simon 25 1700
Matt Paul 14 1700
And I would like the output to look like this:
Family Name [Member/age] [Postcode]
Doe John [John/40, Jane/35, Baby/5] 1400
Mark Peter[Peter/14] 1600
Matt Simon[Simon/25, Paul/14] 1700
It looks like it will involve an array function.
You might be able to find something useful at:
http://www.get-digital-help.com/category/excel/searchlookup/
maybe:
http://www.get-digital-help.com/2012/11/29/lookup-and-return-multiple-values-from-a-range-excluding-blanks/
or:
http://www.get-digital-help.com/2012/03/28/search-for-a-text-string-and-return-multiple-adjacent-values/
I don't know if you'll be able to format it exactly the way you're showing but you might be able to at least achieve so results.

Resources