Solved

Excel - unique values sum formula

Posted on 2014-12-09
6
220 Views
Last Modified: 2014-12-15
I need to create a formula which does not divide duplicate values twice. In the attached spreadsheet, I need to divide Compl/Deal when the value in Job is unique only. The current formula does it twice when duplicate values exist.
What is the best way to do this? A formula would certainly help.

Thanks.
Job.xlsx
0
Comment
Question by:saved4use
6 Comments
 
LVL 45

Expert Comment

by:Martin Liss
Comment Utility
What do you want to see in cells D3 and D4?
0
 
LVL 4

Assisted Solution

by:Brad Rubin
Brad Rubin earned 125 total points
Comment Utility
This should work for you...Put the formula in E2 and fill it down.

It will do the calculation for each unique value in Column B2. Duplicates will be marked accordingly.

=IF(B2<>B1,C2/A2,"Duplicate")
0
 

Author Comment

by:saved4use
Comment Utility
I only want to see 1, NOT 2 1s.
0
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 
LVL 51

Assisted Solution

by:HainKurt
HainKurt earned 125 total points
Comment Utility
D2: =IF(B2<>B1,C2/A2,"")
fill down...
0
 
LVL 45

Assisted Solution

by:Martin Liss
Martin Liss earned 100 total points
Comment Utility
Here's a macro
Sub UniquePerc()
Dim strPrevJob As String
Dim lngRow As Long
For lngRow = 2 To ActiveSheet.UsedRange.Rows.Count
    If Cells(lngRow, 2) <> strPrevJob Then
        Cells(lngRow, 4) = Cells(lngRow, 3) / Cells(lngRow, 1)
        strPrevJob = Cells(lngRow, 2)
    End If
Next
End Sub

Open in new window

0
 
LVL 27

Accepted Solution

by:
Glenn Ray earned 150 total points
Comment Utility
If your data is always sorted by JOB, then the formulas by Brad Rubin and HainKurt should work.  However, only the last occurrence of each set of duplicates will contain the COMPL/DEAL formula.   If your values are not sorted, these formulas will not work.

If you only want the first value to contain the percentage calculation AND if there is a possibility of the data not being sorted by Job, insert this formula in cell D2 and copy down:
=IF(COUNTIF($B$2:$B$100,B2)=1,C2/A2,IF(COUNTIF($B$2:B2,B2)=1,C2/A2,""))

It inserts a blank if the job number is a duplicate (i.e., has occurred earlier in the list).  That can be modified to show any other value (ex., "Dup", "Duplicate", or 0 - zero).

Regards,
-Glenn
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Approximate matching with VLOOKUP and MATCH seems to me to be a greatly under-used technique, and one which is vital for getting good performance out of large lookups. Until recently I would always have advised using an exact match for simplicity an…
How to quickly and accurately populate Word documents with Excel data, charts and images (including Automated Bookmark generation) David Miller (dlmille) Synopsis In this article you’ll learn how to use ExcelToWord! to copy data,charts, shapes …
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now