Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Excel - unique values sum formula

Posted on 2014-12-09
6
Medium Priority
?
268 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 49

Expert Comment

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

Assisted Solution

by:Brad Rubin
Brad Rubin earned 500 total points
ID: 40489931
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
ID: 40489935
I only want to see 1, NOT 2 1s.
0
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 
LVL 61

Assisted Solution

by:HainKurt
HainKurt earned 500 total points
ID: 40489950
D2: =IF(B2<>B1,C2/A2,"")
fill down...
0
 
LVL 49

Assisted Solution

by:Martin Liss
Martin Liss earned 400 total points
ID: 40489957
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 600 total points
ID: 40490075
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

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

: Microsoft Office Collaborate for free and online versions of Microsoft  Word, Excel, Powerpoint, OneNote, Onedrive , Email, Calendar etc. In short we can say that Microsoft office is a suite of servers, applications and services developed by  Micr…
After seeing numerous questions for Dynamic Data Validation I notice that most have used Visual Basic to solve the problem. This suggestion is purely formula based and can be used in multiple rows.
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.

886 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