Compare Data In Excel Not Working - excel

I am working on an Excel Spread Sheet. Where one column has tiers and another column has ratings, so basically what I am trying to do is:
+---+-------+--------+
| | A | B |
+---+-------+--------+
| 1 | Tiers | Rating |
| 2 | 1 | 1 |
| 3 | 1 | 1 |
| 4 | 3 | 1 |
| 5 | 3 | 2 |
| 6 | 2 | 3 |
| 7 | 1 | 3 |
| 8 | 1 | 3 |
+---+-------+--------+
I count each tiers
4 1's
1 2's
2 3's
so to get the maximum rating for each tier I multiply them by 3 so
4*3 = 12 for tier 1
1*3 = 3 for tier 2
2*3 = 6 for tier 3
now comparing that to the rating columns I add up all the values for tier one so 1+1+3+3 = 8
Now to get the percentage I take the 8/12 get 66.67%
so how can I achieve this in Excel? Please Help :(

You can use the following to calculate the 8
=SUMIF(A2:A8,1,B2:B8)
and the following to calculate the 12
=COUNTIF(A2:A8,1)*3
Then you can just calculate the percentage using:
=SUMIF(A2:A8,1,B2:B8)/(COUNTIF(A2:A8,1)*3)

Here's the formula you need. The formula calculates for tier 1
=sumif(A2:A8,1,B2:B8)/(countif(A2:A8,1)* max(if(A2:A8=1,B2:B8)))
Broken down
Count the tier 1s. Count the cells in column A if they contain a 1
=countif(A2:A8,1)
Get the maximum rating. Return the maximum value in column B if column A contains a 1
=max(if(A2:A8=1,B2:B8))
Sum the ratings for Tier 1. Sum if column A contains a 1
=sumif(A2:A8,1,B2:B8)
You can replace the 1 in the formula with a cell reference e.g D1 and enter 1 in D1. Lock the ranges in the formula so that you can autofill across and put 2 in E1 and 3 in F1 etc.
=sumif($A$2:$A$8,D1,$B$2:$B$8)/(countif($A$2:$A$8,D1)* max(if($A$2:$A$8=D1,$B$2:$B$8)))

Related

excel (or OR) formula to delete rows that fulfil some criteria

id | Title | number of occurrences
1 | one | 2
1 | one | 2
16 | text | 4
19 | more | 7
.....
187 | title1 | 3
187 | title2 | 3
187 | title3 | 3
Given the above excel columns, I cannot find a way to delete all rows that match the following criteria:
if number of occurrences == count of id number, then these row must be filtered (for deletion). Which formula should I use?
Desired output after deletion of lines:
16 | text | 4
19 | more | 7
Why not a simple helper column:
All I used was: =COUNTIF($A$1:$A$7,A1)
After drag down I just ordered on three levels:
Column D small to large
Column A small to large
Obviously delete all rows after D changed to 2 after this sorting.

Excel Pivot Chart - % Of Two Values

Let's say I have the following table:
CORP | COAST | CITY | DONE | MISSING | TOTAL
-------------------------------------
New | West | LAX | 2 | 4 | 6
Old | West | SFO | 3 | 3 | 6
New | East | NYC | 4 | 2 | 6
I make a pivot table that looks like this:
CORP:
COAST: NEW | OLD
-------------------------------------
EAST |
SUM OF TOTAL | 6 |
SUM OF DONE | 4 |
SUM OF MISSING | 2 |
WEST
SUM OF TOTAL | 6 | 6
SUM OF DONE | 2 | 3
SUM OF MISSING | 4 | 3
I want to now add a ROW that is the percentage DONE of the TOTAL amount. I.e. something like this:
CORP:
COAST: NEW | OLD
-------------------------------------
EAST |
SUM OF TOTAL | 6 |
SUM OF DONE | 4 |
SUM OF MISSING | 2 |
% DONE | %67|
WEST
SUM OF TOTAL | 6 | 6
SUM OF DONE | 2 | 3
SUM OF MISSING | 4 | 3
% DONE | %33| %50
The formula for % DONE is DONE / TOTAL
I've tried adding another DONE field to the pivot table (i.e. SUM OF DONE2) then setting the value to be % OF, the base field TOTAL and the base value (previous) however that makes % DONE return the value of #N/A. I've tried various combinations of the above however all are returning the same #N/A. I.e. my pivot table is looking like this:
CORP:
COAST: NEW | OLD
-------------------------------------
EAST |
SUM OF TOTAL | 6 |
SUM OF DONE | 4 |
SUM OF MISSING | 2 |
% DONE |#N/A|
WEST
SUM OF TOTAL | 6 | 6
SUM OF DONE | 2 | 3
SUM OF MISSING | 4 | 3
% DONE |#N/A| #N/A
I've tried Googling how to do it but still to no avail. Please let me know if what I am looking for is possible.
On the Analyze tab, add a Calculated field with the formula
= 'DONE'/'TOTAL'
There is an option in Pivot Table Options that allows you to show blank if there is an error, so you don't get an N/A for old/east. You can go into field settings and format the field as a percentage.

Finding the average transaction, per user in Excel. With two criteria to satisfy (user match and month match), each row is a transaction?

I am encountering something I am finding challanging to understand how to script and I was hoping maybe someone who has better excel knowledge may be able to help!
UserID is in column A, and DateofTransaction Is in column I,
I have a code that identifies any change between user id or Month as a 1 else 0. :
ENTERED INTO COLUMN O
=IF(A2<>A1,1,IF(I2<>I1,1,0))
if the ids are Not the same then 1, if the ids are the same then it checks if the months are not the same then 1 too, if both are satisfied then a 0.
Then to try to create some logic where it can group each set I have written
Column O is the
=IF(O2+O3=2,1,IF(O2=0,IF(O3=1,2,IF(O2+O3=0,Q1+1,null))))
Which just identifies the groups of months but unsuccessfully at the moment, What I am looking for is Blank cells if it is not the only one in the month for the user. example excel below
Column A | Column I | Column O | Column Q | Column R |
----------------------------------------------------------------------------------------------
user id | date | 0 or 1 match | transactions per month| Transacting month count
-----------------------------------------------------------------------------------------------
1 | Mar-16 | 1 | 1 | 6
1 | Apr-16 | 1 | BLANK | 6
1 | Apr-16 | 0 | 2 | 6
1 | Aug-16 | 1 | 1 | 6
2 | Aug-16 | 1 | BLANK | 1
2 | Aug-16 | 0 | BLANK | 1
2 | Aug-16 | 0 | BLANK | 1
2 | Aug-16 | 0 | 4 | 1
I will then need to do an Average transactions per month for each user over their lifetime individually. The transacting month count was created with a LookUp to calculate their relative month count.
Any suggestions would be greatly appreciated!
Thanks,
C
Here is the formula that you can use for your question regarding formula in column Q:
=IF(O2+O3=2,1,IF(OR(AND(O2+O3=0,O3<>""),(AND(O2+O3=1,O2=1))),"",COUNTIFS(I:I,I2,A:A,A2)))
Put this in Cell Q2 and drag it down till you have data.

Week average pivot table in Excel

I have the following data on excel:
day | week | #pieces
1 | 1 | 5
2 | 1 | 5
3 | 1 | 5
4 | 1 | 5
5 | 1 | 5
1 | 2 | 5
2 | 2 | 5
3 | 2 | 5
4 | 2 | 5
5 | 2 | 5
1 | 3 | 5
2 | 3 | 5
I did a pivot table that gets the total of #pieces per week.
Now I want to get the average of #pieces per week. I tried to use a calculated field using #pieces/5 but this is not always true for the current week. See week 3 for example:
Week | Average #pieces
1 | 5
2 | 5
3 | 2 (this number '2' should be also '5')
Does anyone know how to do that?
Thanks
As far as I understand what you're trying to do, you don't need a calculated field (which is messing you up, by the way, because you're dividing by the hard-coded 5).
I would pivot with week number as your row label and average of pieces as your values. You can change sum to average in the value field options of the pivot table.

Excel: How to add one column with another column, row by row?

So basically, I have two columns, in two different worksheets that I need to add together.
This may be best explained with an example:
WORKBOOK 1
A B
_____________________________
1 | Unique ID | Number
2 | B1 | 2
3 | C0 | 10
4 | D9 | N/A
5 | 9L | 0
6 | 12 | 5
WORKBOOK 2
A B
_____________________________
1 | Identifier | Price
2 | Q9 | $10.00
3 | 9L | $5.00
4 | B1 | $299.00
5 | C0 | $0.99
6 | 12 | $100.00
The columns in wordbook 1 are named unique_id and price and the columns in workbook 2 are named identifier and number.
Is it possible to do something such as - If unique_id from the first workbook is equal to an identifier within the second workbook, multiply the number and price together. This has to be done for each column/row, and it should somehow either skip or treat the N/A as nothing/zero.
Is something like this possible without the use of macros, and just by using a simple function within a cell? Or is there a far better method than what I am thinking of?
Please try:
=VLOOKUP(A1,[book1]Sheet1!$A:$B,2,FALSE)*B1
copied down to suit.
This approach will work if your columns are sorted. You may be able to build upon it:
=SUMPRODUCT(B2:B6,SUMIF(A2:A6,[Book2]Sheet1!$A$2:$A$6,[Book2]Sheet1!$B$2:$B$6))
The resulting value is 1107.90

Resources