I have a list of name that are on one sheet and need to find the most common repeat name of that list. The list spans for the entire month. Example:
10/1 James
10/2 Bill
10/3 Fred
10/4 Hank
etc...
On another sheet I have this in-cell array that finds the most common, BUT if the list has blanks, it returns an error. Only when the list is full does it then give you an answer.
{=INDEX('Sept 18'!B$2:B$151,MODE(MATCH('Sept 18'!B$2:B$151,'Sept 18'!B$2:B$151,0)+{0,0})),"")}
Is there a way to make it always show a name and exclude the blanks as it goes?
If there is data in B2 through B11 that may include blanks, then use the array formula:
=INDEX(B2:B21,MODE(IF(B2:B21<>"",MATCH(B2:B21,B2:B21,0))))
Array formulas must be entered with Ctrl + Shift + Enter rather than just the Enter key. If this is done correctly, the formula will appear with curly braces around it in the Formula Bar.
Related
The goal is to output the sum of all price in Col B if the corresponding product in Col A is found in the user selection. The user selection may comprise one or multiple products, separated by comma.
I have tried 2 formula, but they both do not work because the criteria in the SUMIF is not treated as an array.
=SUMPRODUCT(SUMIF(A:A,"{"""&SUBSTITUTE(D2,", ",""";""")&"""}",B:B))
=SUMPRODUCT(SUMIF(A:A,CHAR(34)&SUBSTITUTE(D2,", ",CHAR(34)&","&CHAR(34))&CHAR(34),B:B))
Further notes:
There is only one cell (D2) for user selection, where they can specify the product(s) that they want to query for, separated by a comma.
Using split cells, the formula below would work, but this is not what I want because I need users to key in their selection(s) in one cell (D2).
=SUMPRODUCT(SUMIF(A:A,D6:D16,B:B))
Similarly, typing the user selection into the formula would work, but doing so would be too tedious for the user.
=SUMPRODUCT(SUMIF(A:A,{"Apple";"Pear";"Grapes"},B:B))
[Edit] Sample Excel File:
[Edit 2]: Any clue why "{"""&SUBSTITUTE(D2,", ",""";""")&"""}" cannot be passed through the formula as array while {"Apple";"Pear";"Grapes"} works fine?
This matrix formula seems to do the trick (confirm by pressing control+shift+enter):
=SUM(IF(ISERROR(FIND(A1:A4,D1)),0,B1:B4))
I have a spreadsheet that tracks where consumers are referred to. To record individual referrals, users select places from a drop down list. This list then populates a cell, with values separated by commas.
On a separate sheet, I need to count the number of referrals for each referral type. So I need to count the # of times DHHS shows up in the array, for example. I've attempted to do this using the following formula:
=SUM(LEN(range))-LEN(SUBSTITUTE(range,"string",""))/LEN("string")
This is working fine for single word strings, but is not working for multiple word strings like "CHIP Water Inquiry". Any ideas why, and what I can do about it?
You need to make two minor corrections, as you are breathtakingly close in your formula. Add a second SUM formula, tally the subtracted length and then house the two subtracted sections within parentheses as you see in the posted formula. As Boris said, Ctrl + Shift + Enter it, as you probably already know. F1 is assumed to hold your "string" that you wish to count.
=(SUM(LEN(range))-SUM(LEN(SUBSTITUTE(range,F1,""))))/LEN(F1)
The issue I have is that I will be pasting from an external program and the order of the words can vary as between 1-7 possible entries.
What am wanting to do is format and copy by identifying the word in a list of cells and then splitting on condition.
So form example (note text and number are in same cell)
#VALUE!
Time 6:30
Year 4:30
Date All 23
Variance 14:30
I can find the number occurrence with
=FIND({0,1,2,3,4,5,6,7,8,9},L4,1)
However while I can find the first occurrence in this case Time using an array
{=FIND("Time",$L$16:$L$19,1)}
However all the subsequent fail
{=FIND("Year",$L$16:$L$19,1)}
How can I access them?
There seems to be a problem in your array formula. You are getting an error because it is not iterating through the array.
Try this:
=IFERROR(SMALL(IF(LEFT($L$16:$L$19,4)="Time",ROW($L$16:$L$19)-MIN(ROW($L$16:$L$19))+1),1),"")
What this essentially does is to iterate through your values and check if the first 4 letters correspond to what you are looking for. If it finds your word it will give you the row number of the row where the text was found. If it doesn't find anything, the cell will remain blank.
You could now use the formula
=FIND("Time";OFFSET($L$16;L20-1;0))
to look in the given cell for the text you would like to find (assuming that the result is in cell L20).
I currently use the following array formula to find the most common word or number in a range, ignoring any blank cells:
{=(INDEX(D1:D10,MODE(IF((D1:D10<>"")*ISNA(MATCH(D1:D10,$A$1:$A1,0)),MATCH(D1:D10,D1:D10,0)))))}
I am now looking to do something slightly different. I still want to find the most common word or number in a range, however I now have 2 lists: the first is a list of 'positive' words/numbers and the second is a list of 'negative' words/numbers.
To illustrate using an example: the colour green appears in the 'positive' list 4 times and the colour blue appears twice in the 'positive list', but green appears 3 times in the 'negative' list and blue does not appear at all in the 'negative' list. Using the above formula on the first list would return green as the most common word. However I now want it to take into account that green is not the most common word given the combined lists (i.e. 4 positives - 3 negatives = 1 green, and 2 positives - 0 negatives = 2 blue).
In the below image, using the formula under each list shows green to be the most common word. I would like to combine these lists and cancel out any instances where the colour appears on both instances - so 3 of the greens on the positive list would be cancelled out with the 3 greens on the negative list, leaving only one left.
In essence, I suppose I am trying to create a tally or ledger of some kind where rather than numbers that add or subtract I have words whose frequency is added or subtracted.
Thanks for the help, and apologies if I haven't been too clear in the task!
This should work:
=IF(SUMPRODUCT((MMULT(COUNTIF(OFFSET(B2:B11,,{0,1}),B2:B11),{1;-1})=MAX(MMULT(COUNTIF(OFFSET(B2:B11,,{0,1}),B2:B11),{1;-1})))/COUNTIF(B2:B11,B2:B11&""))>1,"No Favourite",INDEX(B2:B11,MATCH(MAX(MMULT(COUNTIF(OFFSET(B2:B11,,{0,1}),B2:B11),{1;-1})),MMULT(COUNTIF(OFFSET(B2:B11,,{0,1}),B2:B11),{1;-1}),0)))
And for non-contiguous, dynamically-defined ranges, assumed to be stored as Defined Names Positive and Negative, array formula**:
=IF(SUM((COUNTIF(Positive,Positive)-COUNTIF(Negative,Positive)=MAX(COUNTIF(Positive,Positive)-COUNTIF(Negative,Positive)))/COUNTIF(Positive,Positive&""))>1,"No Favourite",INDEX(Positive,MATCH(MAX(COUNTIF(Positive,Positive)-COUNTIF(Negative,Positive)),COUNTIF(Positive,Positive)-COUNTIF(Negative,Positive),0)))
Regards
**Array formulas are not entered in the same way as 'standard' formulas. Instead of pressing just ENTER, you first hold down CTRL and SHIFT, and only then press ENTER. If you've done it correctly, you'll notice Excel puts curly brackets {} around the formula (though do not attempt to manually insert these yourself).
First list your candidates in column D starting at D2
Then in E2 enter:
=COUNTIF(B$2:B$12,D2)-COUNTIF(C$2:C$12,D2)
and copy down.
Finally in F2 enter:
=INDEX(D:D,MATCH(MAX(E:E),E:E,0))
With your data:
I'm currently using (SAP) Business Objects to build a report.
I want to be able to identify rows where a person has both their first and middle name in the same cell.
For example: Cell A1 = "JOHN" Cell B1 = "THOMAS FREDRIC"
What I want to be able to do is only show the cells that include two names in one, e.g Cell B1.
Any advice would be much appreciated!
Build yourself a variable, something like the following should do,
=Pos(Trim([First Names]); " ")
It Trim(s) any leading and trailing spaces from your First Names column and then returns the Pos(ition) of the first space it finds in the column. So any result other than 0 indicates two or more names in the column. Once you can identify the rows you're after there are a number of options (which I can't currently remember the details of) open to you.