Split String in Reporting Services expression - string

I have a free text field that have full name of consultants.
e.g. Smith John
I would like to display in reporting services expression as John Smith.
i want to swap the name around, bring the first name first.
any help.

=Right(Fields!name.Value, Len(Fields!name.Value) - InStr(Fields!name.Value, " "))
& " "
& Left(Fields!name.Value, InStr(Fields!name.Value, " ") - 1)

Related

Hi "Mr." Brad Pitt! in column

Column A - first name list
Column B - last name list
Column C - salutation list
I want in column D: HI "salutation" + first name + last name!
I try ="Hi &C1&" "&A1&" "&B1&"!" -> result Hi Mr. Brad Pitt!
But I want the result Hi "Mr." Brad Pitt!
You can use two double quotes where you want each double quote to be, in order to escape it.
="Hi """&C1&""" "&A1&" "&B1&"!"
you can use 2 double quotes to get a double quote in your text.
Try this instead: ="Hi """&C1&""" "&A1&" "&B1&"!"
Try below formula-
="Hi " & CHAR(34) & C1 & CHAR(34) & " " & A1 &" "&B1&"!"

How do I use the FIND function to split a name from an account number in Excel?

I'm trying to use a left(find) function to split a name from an account number.
EX: John Smith G123456 -> G123456
Is there a way for excel to detect a string that starts with a specific letter and ends with any digit?
My current implementation has the full string copy pasted from firefox into A1, and then A2 has the following formula:
=LEFT(A1,FIND("G",A1)-1)
This works just fine until I have a name that has G in it.
Thank you!
Assuming you just want the last word of the input, which would always be the account number, you may try this formula:
=TRIM(RIGHT(SUBSTITUTE(A1, " ", REPT(" ", 100)), 100))
To isolate the name, you could try removing space followed by the account (the latter which we found using the above formula):
=SUBSTITUTE(A1, " " & TRIM(RIGHT(SUBSTITUTE(A1, " ", REPT(" ", 100)), 100)), "")
If the Account number is always 1 letter 6 digits (7 characters)
you could use
=MID(A1,LEN(A1)-6,7) to get the account number
and then =LEFT(A1,LEN(A1)-8) for the Name

Multiple =if(isnumber(search))) for excel issue (If text SR or SNR exists, get cells AG, AG and AA)

If SNR text exists it gets values of AD6. If it doesn’t exist it get values of AD6.
If SR exists, it gets value of AA1
I am able to get this working with =IF(ISERR(SEARCH("SNR "," " & Sheet1!$D6& " ")),Sheet1!AD6,AD6)
However I cannot seem to include SR.
=IF(ISERR(SEARCH("SNR "," " & Sheet1!$D6& " ")),Sheet1!AD6,AD6) AND IF(ISERR(SEARCH("SR "," " & Sheet1!$D6& " ")),Sheet1!AA1,AA1)
Is there a way around this issue or is this a limitation of excel?
I have included an image to more accurately convey what I am saying.

Excel search function - match case

I'm trying to find if cells have specific string or not. This is how I do it right now:
=IF(ISNUMBER(SEARCH("AAA";L2)); "yes"; "no")
If a cell has "AAA", I write to another cell yes, if not, I write no...
The problem is that it also gets true answer for AAA1 or AAA1234 for an example, how can I return true statement only for AAA?
If there are trailing numbers/charcters in my string, I want to reutrn no, but the cell itself might be longer... for and example "AAA BVC BFD2" etc. Then I want to return true. False if for an example: "AAA1 BVC BFD2"
As I mentioned in comments, you can use this one:
=IF(ISNUMBER(SEARCH(" AAA ";" " & L2 & " ")); "yes"; "no")
How it works:
suppose you have a string "AAA BVC BFD2" in cell L2.
" " & L2 & " " part modifies this string to " AAA BVC BFD2 " (note, there're additional spaces in the end and in the beggining)
now, we're able to search " AAA " (with spaces) in modified string " " & L2 & " ".
I'm clearly missing something as it seems to me that you could do this with something as simple as
=IF(LEFT(A1,4)="AAA ","yes","no")
I don't think the question is particularly clear, if I'm being honest...

Move Two characters from beginning to end of string

I have an Excel 2010 document which has hundreds of rows each with a cell as below:
(without the quotes, of course)
"XX - A Name of Something Here"
Which I need to change to:
"A Name of Something Here (XX)"
I'm trying to figure out the best way to accomplish this and could really use some assistance.
Try this:
=RIGHT(A3, LEN(A3) - 5) & " (" & LEFT(A3, 2) & ")"
which means
all but the last 5 chars of the string, counting from right to left
5 because XX space dash space is 5 chars long
a space and an open parenthesis
the leftmost two chars ie XX
a close parenthesis.
This formula will work given your example
=MID(A1&" ("&A1,5,LEN(A1))&")"
How about:
=MID(A1,3,9999) & "(" & LEFT(A1,2) & ")"
but how about the dash??
=RIGHT(A1, LEN(A1) - 5) & " (" &LEFT(A1, 2) & ")"
This will work too - I like "concatenate" since I don't need to keep track of the &'s
=CONCATENATE(RIGHT(A3,LEN(A3)-5)," (", LEFT(A3,2),")")
So many fun ways to do the same thing...

Resources