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.
Related
I have a roster table for a sports facility that has been formatted and has a column of merged cells (for human readability). Unfortunately I cannot change the formatting to eliminate the merged cells - too many people use it and in any case I'd need to overhaul all the formulas everywhere.
The cells contain names and merge 4 rows of a single column.
Formatted roster table w/ sample data
In a separate range I am trying to take this formatted info and put it into 1st normal form for analysis & graphing purposes. Since merged cells only contain the top-leftmost value, when trying to copy the column contents by formula (e.g. "=B14") it only shows the name in the top cell followed by 3 empty ones below.
I need to fill in the blank rows by copying the athlete names down. The other column formulas are working just fine.
For the life of me I can't figure it out. It has to be a formula and not apps script due to mobile use, and I've always been really bad with certain formulas and good with others. Usually I can make a guess at it, but this time I'm just lost.
Can someone point me in the right direction?
use:
=ARRAYFORMULA(IF(B2:B="",, VLOOKUP(ROW(A2:A), IF(A2:A<>"", {ROW(A2:A), A2:A}), 2, 1)))
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.
I have a small tool that generates all the combinations of a set of items using binary patterns. The tool works, but it now requires a "helper" column for each item. (the tool requires no VBA)
I need some help to remove the "helper" columns.
I put the items in the first row starting with B1. In A2, I enter:
=DEC2BIN(ROW()-1,COUNTA($1:$1))
and copy downwards. (this makes the binary patterns)
I fill the "helper" columns (B through E) by putting:
=--MID($A2,COLUMNS($A:A),1)
in B2 and copying both across and downward.
Finally in F2 I enter the array formula:
=TEXTJOIN(",",TRUE,IF($B2:$E2=1,$B$1:$E$1,""))
and copy downwards:
As you can see, the formula is really easy. It looks for the 1's in columns B through E and joins the appropriate words from the first row.
I am trying to replace the $B2:$E2=1 with some kind of MID(A2) function. (this will eliminate the need for columns B, C, D, ...)What I have tried is the array formula:
=TEXTJOIN(",",TRUE,IF(MID(A2,ROW(INDIRECT("1:" & LEN(A2))),1)=1,$B$1:$E$1,""))
But this just yields blanks. Any help will be greatly appreciated!
EDIT#1:
If I use:
=TEXTJOIN(",",TRUE,IF(MID(A2,ROW(INDIRECT("1:" & LEN(A2))),1)="1",$B$1:$E$1,""))
I get a large set of the items, unrelated to the binary pattern.
This array formula (CSE) will eliminate B:E, and is relatively easily expandable to handle more names. It assumes you have the TEXTJOIN function (Office 365)
=TEXTJOIN(",",TRUE,IFERROR(INDEX({"Larry";"Moe";"Curly";"Shep"},N(IF(1,N(AGGREGATE(15,6,1/MID(A2,{1,2,3,4},1)*{1,2,3,4},{1,2,3,4}))))),""))
If permissible, you can replace the array constant containing the names with a vertical list of names.
EDIT: To make the formula more dynamic, enter the list of Names in some column, and NAME it Names, then you can use this formula:
=TEXTJOIN(",",TRUE,IFERROR(INDEX(Names,
N(IF(1,N(AGGREGATE(15,6,1/MID(A2,ROW(INDIRECT(
"1:"&COUNTA(Names))),1)*ROW(INDIRECT("1:"&COUNTA(
Names))),ROW(INDIRECT("1:"&COUNTA(Names)))))))),""))
Of course, you'd then change the A2 formula to:
=IFERROR(DEC2BIN(ROW()-1,COUNTA(Names)),"")
and fill down until you get blanks.
EDIT2: Eliminating Column A, and with a named range named Names:
=TEXTJOIN(",",TRUE,IFERROR(INDEX(Names,N(IF(1,AGGREGATE(
15,6,1/MID(IFERROR(DEC2BIN(ROW()-1,COUNTA(Names)),""),
ROW(INDIRECT("1:"&COUNTA(Names))),1)*ROW(INDIRECT(
"1:"&COUNTA(Names))),ROW(INDIRECT("1:"&COUNTA(Names))))))),""))
This will manually pick up up and return, have to change the frozen values, but its limited to combine only 4 words, the formulas in column A produce a text based result.
=TEXTJOIN(",",TRUE,IF(LEFT(A2,1)="1",$B$1,""),IF(MID(A2,2,1)="1",$C$1,""),IF(MID(A2,3,1)="1",$D$1,""),IF(RIGHT(A2,1)="1",$E$1,""))
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)
I'm trying to setup a formula that will return the contents of an related cell (my related cell is on another sheet) from the smallest 2 results in an array. This is what I'm using right now.
=INDEX('Sheet1'!$A$40:'Sheet1'!$A$167,MATCH(SMALL(F1:F128,1),F1:F128,0),1)
And
=INDEX('Sheet1'!$A$40:'Sheet1:!$A$167,MATCH(SMALL(F1:F128,2),F1:F128,0),1)
The problem I've run into is twofold.
First, if there are multiple lowest results I get whichever one appears first in the array for both entries.
Second, if the second lowest result is duplicated but the first is not I get whichever one shows up on the list first, but any subsequent duplicates are ignored. I would like to be able to display the names associated with the duplicated scores.
You will have to adjust the k parameter of the SMALL function to raise the k according to duplicates. The COUNTIF function should be sufficient for this. Once all occurrences of the top two scores are retrieved, standard 'lookup multiple values' formulas can be applied. Retrieving successive row positions with the AGGREGATE¹ function and passing those into an INDEX of the names works well.
The formulas in H2:I2 are,
=IF(SMALL(F$40:F$167, ROW(1:1))<=SMALL(F$40:F$167, 1+COUNTIF(F$40:F$167, MIN(F$40:F$167))), SMALL(F$40:F$167, ROW(1:1)), "") '◄ H2
=IF(LEN(H40), INDEX(A$40:A$167, AGGREGATE(15, 6, ROW($1:$128)/(F$40:F$167=H40), COUNTIF(H$40:H40, H40))), "") '◄ I2
Fill down as necessary. The scores are designed to terminate after the last second place so it would be a good idea to fill down several rows more than is immediately necessary for future duplicates.
¹ The AGGREGATE function was introduced with Excel 2010². It is not available in earlier versions.
² Related article for pre-xl2010 functions - see Multiple Ranked Returns from INDEX().
The following formula will do what I think you want:
=IF(OR(ROW(1:1)=1,COUNTIF($E$1:$E1,INDEX(Sheet1!$A$40:$A$167,MATCH(SMALL($F$1:$F$128,ROW(1:1)),$F$1:$F$128,0)))>0,ROW(1:1)=2),INDEX(Sheet1!$A$40:$A$167,MATCH(1,INDEX(($F$1:$F$128=SMALL($F$1:$F$128,ROW(1:1)))*(COUNTIF($E$1:$E1,Sheet1!$A$40:$A$167)=0),),0)),"")
NOTE:
This is an array formula and must be confirmed with Ctrl-Shift-Enter.
There are two references $E$1:$E1. This formula assumes that it will be entered in E2 and copied down. If it is going in a different column Change these two references. It must go in the second row or it will through a circular reference.
What it will do
If there is a tie for first place it will only list those teams that are tied for first.
If there is only one first place but multiple tied for second places it will list all those in second.
So make sure you copy the formula down far enough to cover all possible ties. It will put "" in any that do not fill, so err on the high side.
To get the Scores use this simple formula, I put mine in Column F:
=IF(E2<>"",SMALL($F$1:$F$128,ROW(1:1)),"")
Again change the E reference to the column you use for the output.
I did a small test: