Read options in more than one cell

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

If the A column lists the salespersons name, and the B column lists their
sales. I would like a formula that will total all individuals’ sales, and
then list the top sales in a separate cell, with the name of that salesperson
in the cell next to the totaled sales.

For example: based on the numbers below, I would like Amber to appear in D1
and $297.69 to appear in E1. Thanks for your help.

Amber $158.69
Amber $139.00
Beverly $139.87
Beverly $41.90
Beverly $73.97
Beverly $24.95
Blase $64.99
Blase $208.98
 
This one is for the name, and it's a little messy, and it requires the
formula that returns the highest valus (farther down this posting):

=IF(E2=SUMIF(A1:A8,"Amber",B1:B8),"Amber",IF(SUMIF(A1:A8,"Beverly",B1:B8),"Beverly","Blase"))

It will return a match for Amber or Beverly. It will return Blase if it
can't match the other two. You may try to refine it or see if someone can
post a more compact formula.

This one is for the value:
=MAX(SUMIF(A1:A8,{"Amber","Beverly","Blase"},B1:B8))

The names in curly brackets basically tell Excel to add all the Anmber
values, all the Beverly values and all the Blase values, and then return the
highest total.

Hope this helps,
tj
 
The first formula should have been
=IF(E2=SUMIF(A1:A8,"Amber",B1:B8),"Amber",IF(E2=(SUMIF(A1:A8,"Beverly",B1:B8)),"Beverly","Blase"))

I left out the E2=
at the start of the second IF statement when I retyped it. Next time I'll
copy and paste.
:)

tj
 
But what if column A contains several hundred names?

I tend to avoid illustrating a problem by way of example when I post.

Examples can be useful to clarify intent, and I used to include examples
habitually, but they have the danger, as here, that responders concentrate
on producing a solution to the specific example rather than the general
case.


I thought the problem was a nice challenge, but lack the time to think about
it.
 
If you name the range of salespersons in colunm A to be called SalesPersons
and name the range of sales in column B to be called Sales
then in cell E1, array-enter the formula
=MAX(SUMIF(SalesPersons,SalesPersons,Sales))
(hit control+Shift+enter when entering the formula, which should then be
displayed in curly brackets in the formula bar)

Still thinking about the formula for cell D1. That is the challenge.
 
A slightly inelegant solution, this requires you to reserve a column in
which to reside some temporary workings. You can hide the column. Suppose
we use column Z for this purpose, and your SalesPersons occupy cells
$A$1:$A$100, with Sales in $B$1:$B$100

Then in cell $Z$1 enter the formula
=SUMIF($A$1:$A$100,A1,$B$1:$B$100)
Copy that formula down to $Z$2:$Z$100

Then in cell $E$1 enter the formula
=MAX($Z$1:$Z$100)
and in cell $D$1 enter the formula
=INDEX($A$1:$A$100,MATCH(E1,$Z$1:$Z$100,FALSE))

This formula will not distinguish a case where two+ salespersons equally
rank for maximum sales - it will simply return one of those salespersons.
Still, it may suffice for your purposes.

There is probably a way of getting to a formula for D1 that uses an array
formula without using the cells in column Z in the above example, but it is
just beyond my reach at the moment. As per my previous post, an alternative
formula for E1 is fairly trivial without resorting to column Z.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top