In Excel 2010, I have to table which have 5 columns and data shown in the picture
.
The rule is basically once someone’s name is in one of the three columns [Edit, Translation or Final Edit], I should add the Word count to them. But if the same name is in 2 of those columns, the word count should be added just once.
Is there a way to count how many words that each person have processed? Thanks.
Use SUMPRODUCT:
=SUMPRODUCT(--(($C$2:$C$13 = G7)+($D$2:$D$13 = G7)+($E$2:$E$13 = G7)>0),$B$2:$B$13)
Yes you can do it...Lets say you have a date like 2-Nov-2018 for entries...Change your output table and replace "Total Word COunt" by month name i.e. "Nov" and use below formula :
=SUMPRODUCT(--(($C$2:$C$13 = G9)+($D$2:$D$13 = G9)+($E$2:$E$13 = G9)+(TEXT((F4:F15),"MMM")=H8)>0),$B$2:$B$13)
Related
Hey I have a question for MS Access.
In Excel I would use the function =countif(A1:$A$2000; $B$3). So it only counts the ones in the same row and below.
How do I do that in MS Access? Something like count(iff([]))?
Cheers
Actually, there is an IIF function in ms-access. You can get the count if with a pipeline like:
SELECT Sum(IIf(id / 2 = id \ 2, 1, 0)) AS sum_of_even
FROM table;
In this case you obtain the sum of even ids. You can change the condition id / 2 = id \ 2 as you wish.
try this
counttotal: Count(IIf([credit]<20000,[credit],Null))
where credit is name of column, and you want to count the number of records where the value in the credit column is less than to 20,000
I have a data table that records cost savings data and I have 1 row per project. This has overall project type data such as annual spend, annual savings, etc. but also has the months the savings fall into. To pivot on this data, I converted it to a table with PowerQuery but some columns repeat such as annual spend for each month where there are savings so I might get 10 rows for savings which is correct, but the annual spend is duplicated 10 times. Can I remove duplicates in just those columns retaining the other data.
I have searched and tried various solutions but haven't found one that works. I am not set on data table format, so am open to anything.
Below is a sample of the data
Sample of PowerQuery
As you will see, Baseline Spend, Negotiated Spend, Savings Amount are all shown for each row and I need to use these in a pivot/slicer.
Any help would be appreciated.
Regards,
Keith
I think one solution might be to "only keep the first1 annual spend per project". More abstractly, "only keep the first value in column(s) X per column(s)Y".
Below is some mock/dummy data. I only want to keep the highlighted values in my annual spend column (as the highlighted values are the first "annual spend" figures per "project").
This is the M code I'm using to achieve this. (To try it, open the Query Editor > Advanced Editor (near top right) > copy-paste code below to there > OK).
let
OnlyKeepFirstValueInColumn = (someTable as table, columnsToNullify as list) as table =>
let
firstRow = Table.FirstN(someTable, 1), // This assumes first row contains a non-blank value.
remainingRows = Table.Skip(someTable, 1),
loopAndNullify = List.Accumulate(columnsToNullify, remainingRows, (tableState, currentHeader) => Table.TransformColumns(tableState, {{currentHeader, each null}})),
combined = firstRow & loopAndNullify
in combined,
FirstValueOfColumnsPerGroup = (someTable as table, groupByColumns as list, columnsToNullify as list) =>
let
group = Table.Group(someTable, groupByColumns, {{"toCombine", each OnlyKeepFirstValueInColumn(_, columnsToNullify), type table}}),
combined = Table.Combine(group[toCombine])
in combined,
aggregatedTable = Table.FromColumns({Text.ToList("aaabbbccccdddeeefg"), List.Repeat({1000}, Text.Length("aaabbbccccdddeeefg"))}, type table [project=text, annual spend=number]),
transformed = FirstValueOfColumnsPerGroup(aggregatedTable, {"project"}, {"annual spend"})
in
transformed
The important bit to understand is this line:
transformed = FirstValueOfColumnsPerGroup(aggregatedTable, {"project"}, {"annual spend"})
in which you should replace:
aggregatedTable with whatever variable/expression contains your table
{"project"} with the name of your "project" column (keep the curly braces {} though as they let you pass in several columns if needed)
{"annual spend"} with the names of whichever column(s) you want to keep only the first value in (keep the curly braces {})
This is what I get (which I think is similar to what you want):
1To keep things simple, we'll say "first" here means the value in the first row. It could have meant "first non-null value" or "first value satisfying some particular condition or logic", but your data suggests the simpler definition will work okay.
I apologise if this comes across as a newbie query, but I have been stumped by this for some time.
I am building an excel spreadsheet for my staff to be able to compare stock listings easily and automatically based on reference data held in a different sheet within the same workbook.
The difficulty is that I want to pull this reference data based on the values chosen from a total of 6 conditional drop down lists I have created.
Based on what is selected, the values on say Sheet 1 will display the relevant values from Sheet 2 automatically (i.e. if one of the list options is changed, the "results" will update with the associated data automatically).
I have tried using lookup functions, arrays and nested if functions, but I have been unable to get it to work properly - probably due to my own lack of depth of knowledge for this type of coding. As such I am looking for advice about the best way to code this function requirement.
The format of what I am trying to do is this:
Sheet 1 - The 'GUI'
This sheet has the dropdown lists and the "displayed results" section
dd1 - State (6 options)
dd2 - Product Type (4 options)
dd3 - Product Brand (3 options)
dd4 - Product variation 1 (eg model) (say, 2 options)
dd5 - Product variation 2 (eg colour) (5 options)
dd6 - Product variation 3 (eg size) (3 options)
Sheet 2 - Reference data
Table 1 - ACT products and variations
Table 2 - VIC products and variations
Table 3 - NSW products and variations etc and so on...
Based on choices above in Sheet1, I want the product & price to be listed in cells below. Currently I have conditional functions listing the avail options based on the choice made for the prev list working fine.
I need it so that:
IF dd1 = "ACT" AND dd2 = "Mobile" AND dd3 = "Apple" AND dd4 = "iPhone" AND dd5 = "white" AND dd6 = "128Gb"
Then
The results cell, say Sheet1!C10, will reflect the price of the item based on a table of data lists in Sheet2 (say for eg the listed value is in Sheet 2, Cell A5)
But if say the list choices change, eg dd3 was changed to "Samsung", then the lists will auto update because of the conditional formatting already; but I then want the results to be updated accordingly (eg the price listed based on the new choices will then reflect Sheet2!B3).
Because of the many options and variations, there are many tables in Sheet 2 for reference, so the 'IF' statement to cover all these options would be massive and convoluted.
Is there a relatively concise way of writing vb code for this function to suit?
My current code under the worksheet_change sub
If Range("D10").Value = "ACT" And (Range("D11").Value = "Mobile" And (Range("D13").Value = "Samsung" And (Range("D14").Value = "S7") And (Range("D15").Value = "Black") And (Range("D16").Value = "128"))))) Then
Sheets("Sheet2").Range("F20").Value = Sheets("Sheet4").Range("C5").Value2
Sheets("Sheet2").Range("F29").Value = Sheets("Sheet4").Range("C6").Value2
ElseIf Range("D10").Value = "ACT" And (Range("D11").Value = "Mobile" And (Range("D13").Value = "Samsung" And (Range("D14").Value = "S7") And (Range("D15").Value = "Black") And (Range("D16").Value = "256"))))) Then
Sheets("Sheet2").Range("F21").Value = Sheets("Sheet4").Range("C8").Value2
Sheets("Sheet2").Range("F22").Value = Sheets("Sheet4").Range("C9").Value2
Sheets("Sheet2").Range("F29").Value = Sheets("Sheet4").Range("C10").Value2
'and so on. With all the variations, there's prob going to be approx 20+ elseif statements.
End If
Ive only pasted 2x sections for the purpose of this request. I can copy it down or adjust the code accordingly for each option.
Ive not used nor written arrays before (successfully i.e.) so I have no clue/understanding if that is a better way, but i have written vba for basic functions and macros before; but im open to learn.
WARNING - Using Excel 2011 for Macs, inexperienced user
Hi All,
I have a sheet in Excel with a bunch of categorical fields and some numerical ones as well. Let's say it looks like the following:
I would like to make a pivot table that will display the average click rate (avg_click_rate) of the unique combinations of [year, region], i.e. the combinations of fields in the pivottable's rows section.
For example, the avg_click_rate of [years=5] is:
(0.5*10)/(10 +5 ) + (0.6*5)/(10+5) = 0.53
while the avg_click_rate of [region=north] is:
(0.6*5)/(5+20) + (0.2*20)/(5+20) = 0.28
and the avg_click_rate of [years=5, region=south] is:
(0.5*10)/10 = 0.5
I know I have to make a custom Calculated Field to do this, but for the life of me I cannot figure out how to code the formula. Any help would be seriously, seriously appreciated.
To be clear, my formula would be:
SUM{ (click_rate * number_members) / SUM{number_members} }
where the numerator is a single value for each row included in the unique combination of [year, region], while the denominator is a constant - the total number_members for the unique combination of [year, region].
You should create a new column in your source table:
product = click_rate * number_members
And then create a Calculated Field in the pivot table:
CF = product / number_members
Using AVERAGEIFS:
AVERAGEIFS($C$2:$C$9,$A$2:$A$9,A2,$B$2:$B$9,B2)
EDIT:
You can add up to 127 conditions, see: AVERAGEIFS function
Criteria_range1, criteria_range2, … are 1 to 127 ranges in which
to evaluate the associated criteria.
IF I have a table like this:
[1968][?]
[1968][?]
[1968][?]
[1969][?]
[1969][?]
[1970][?]
[1970][?]
I want to count the number of times each year occurs in the next column.
=COUNTIF(A1:A7,"1968")
How can I do this automatically for each year? (because the table is not this small).
I reduced your example data by one row with year 1969 for better result display
[1968][=COUNTIF($A$1:$A$6, $A1)]
[1968][=COUNTIF($A$1:$A$6, $A2)]
[1968][=COUNTIF($A$1:$A$6, $A3)]
[1969][=COUNTIF($A$1:$A$6, $A4)]
[1970][=COUNTIF($A$1:$A$6, $A5)]
[1970][=COUNTIF($A$1:$A$6, $A6)]
Just enter the formula in B1 and drag-copy it until end of the column B.
Results in
[1968][3]
[1968][3]
[1968][3]
[1969][1]
[1970][2]
[1970][2]