Nesting an IF function in a SUMIF function - excel

I have a list of sales people, but only a portion of their sales can count in the sum total. Example:
SP Sales
John 600
Jane 200
John 50
Mike 150
=SUMIF(SP,"John",Sales) will give me the total of all John's sales.
But only up to 125 of each of John's sales can count in this total. So the result should be 175.
I tried: =IF(sales,>=125,"125"+SUMIF(SP,"John",Sales)) but it didn't work.
What do I require for it to work?

Please try:
=SUMIFS(B:B,A:A,"John",B:B,"<"&125)+125*COUNTIFS(A:A,"John",B:B,">=125")

Use an array formula like this:
{=SUM(--(A2:A5="John") * IF(B2:B5>125,125,B2:B5))}

Related

Google sheets formula to get the Top 5 List With Duplicates

I'm trying to compile a best 5 and worst 5 list. I have two rows, column B with the number score and column C with the name. I only want the list to include the name.
In my previous attempts the formula would get the top/bottom 5 but as soon as a duplicate score appeared the first known name with that value would just repeat.
Here is my data
26 Cal
55 John
55 Mike
100 Steve
26 Thomas
100 Jaden
100 Jack
95 Josh
87 Cole
75 Brett
I've managed to get the bottom 5 list formula correct. This formula works perfectly and includes all names of duplicate scores.
Example of what I get:
Cal
Thomas
John
Mike
Brett
=INDEX($C$56:$E$70,SMALL(IF($B$56:$B$70=SMALL($B$56:$B$70,ROWS(E$2:E2)),ROW($B$56:$B$70)-ROW($B$56)+1),SUM(IF($B$56:$B$70=SMALL($B$56:$B$70,
ROWS(E$2:E2)),1,0))-SUM(IF($B$56:$B$70<=SMALL($B$56:$B$70,ROWS(E$2:E2)),1,0))+ROWS(E$2:E2)))
Here is the formula I've tried to get the top 5 - however I keep getting an error.
=INDEX($C$56:$E$70,LARGE(IF($B$56:$B$70=LARGE($B$56:$B$70,ROWS(E$2:E2)),ROW($B$56:$B$70)-ROW($B$56)+1),SUM(IF($B$56:$B$70=LARGE($B$56:$B$70,
ROWS(E$2:E2)),1,0))-SUM(IF($B$56:$B$70<=LARGE($B$56:$B$70,ROWS(E$2:E2)),1,0))+ROWS(E$2:E2)))
Example of what I'm looking for
Steve
Jaden
Jack
Josh
Cole
You can set two queries like this for both cases:
=QUERY(B56:C70,"Select C order by B desc limit 5")
=QUERY(B56:C70,"Select C order by B limit 5")
Use SORTN() function like-
=SORTN(A1:B10,5,,1,1)
To keep only one column, wrap the SORTN() function with INDEX() and specify column number. Try-
=INDEX(SORTN(A1:B10,5,,1,1),,2)

Add Partial Text Match as Criteria to a Count Unique Formula

I've been trying to add a partial text match as a criteria to the formula below, but with no success so far:
=SUM(--(FREQUENCY(IF(Sales[ClientID]=A21;IF(Sales[Operation]="Sale*";Sale[InvoiceNumber]));Sale[InvoiceNumber])>0))
The piece IF(Sales[Operation]="Sale*"; is the one that when added, always give me 0 as the result.
Here's some data:
Sales Table
Date ClientID Operation InvoiceNumber Total
01/01/2019 18090 Sale Adv 101010101 100
01/02/2019 20897 Sale Cash 105327892 100
01/03/2019 18090 Sample 41357398 100
01/01/2019 30456 Sale Check 43167429 100
10/04/2019 779584 Sale Cash 4326719 100
01/05/2019 30456 Refused 34162781 100
01/01/2019 90909 Sale Cash 3412679821 100
Results Table
ClientID Purchase Frequency
779584 ???
Here's the solution I borrowed from Scot Craner, in case someone else falls into the same question:
=SUM(--(FREQUENCY(IF(Sales[ClientID]=A21;IF(ISNUMBER(SEARCH("Sale";Sales[Operation]));Sale[InvoiceNumber]));Sale[InvoiceNumber])>0))
Thanks everyone!

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.

Excel countif or if

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

Search and return multiple rows in excel

This is my problem. I have a spreadsheet containing alot of data. What I want to do is create a way that I can search for a recurring name, and return all the information (rows) associated to it. Here is a mini example below:
A B C D E F
ID Name Date Client ID Balance Owed
100 Tom 1/11/11 256 300 200
100 Tom 1/12/11 565 500 150
100 Tom
200 Jay
200 Jay
300 Frank
100 Tom
100 Tom
400 Ted
You get the idea (I hope). So what I want to do on another sheet is search for "Tom" and get it to return ALL instances of Tom in the Name column and return the data in the rows associated to Tom. So I would get back 5 results of Tom with all the necessary information. Thanks in advance!
B
Have you tried Pivot Table option found in the Excel, this might help you without any coding, if all you need is to find some duplicates
Could just apply a filter to the data and have the user select their name from column B. No need to copy data this way, so the update issue goes away. (probably best to delete the blank row below the heading row first)

Resources