nested if and search and move help

Brad_Miller

Board Regular
Joined
Sep 18, 2014
Messages
56
Hi Excel geniuses

I am trying to sort my movies I have and I have them listed with a marker at the end of the file either [720p] or [1080p] or nothing

I have used these formulas to move the resolution tag to the front so I can group movies by resolution.

I used these serpeatly to move the tag but I get so loast trying to make them a nested if
=IF(SEARCH("[720p]",A1),CONCATENATE(RIGHT(A1,0),"[720p] ", LEFT(A1,FIND("[720p]",A1,1)-1)))
=IF(SEARCH("[1080p]",A9),CONCATENATE(RIGHT(A9,0),"[1080p] ", LEFT(A9,FIND("[1080p]",A9,1)-1)))

AND!
Ideally i would like to have one formula that move both tag and then if there is no tag leave it as is.

Original Namemodified Name

<tbody>
</tbody>

13 Hours The Secret Soldiers of Benghazi (2016) [1080p]

<tbody>
</tbody>
[1080p] 13 Hours The Secret Soldiers of Benghazi (2016)

<tbody>
</tbody>
16 Blocks (2006) [720p]

<tbody>
</tbody>
[720p] 16 Blocks (2006)

<tbody>
</tbody>
200 MPH

<tbody>
</tbody>
200 MPH

<tbody>
</tbody>

<tbody>
</tbody>


Thanks in advance!
 
Last edited:

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
Hello Brad,

Provided the resolution tag is always at the end of the movie name, this formula will place it at the beginning. The formula assumes the names start in "A1".

=IFERROR(REPLACE($A1&LEFT($A1,SEARCH("[",$A1,1)-1),1,SEARCH("[",$A1&LEFT($A1,SEARCH("[",$A1,1)-1),1)-1,""),$A1)
 
Upvote 0
A bit shorter...

In B1 enter and copy down:

=IFERROR(REPLACE(A1,1,FIND("[",A1)-1,"")&" "&LEFT(A1,FIND("[",A1)-1),A1)
 
Upvote 0
WOW - Ok now you guys are just showing off!

Now can you explain the formula in english? ;)

[A] The REPLACE bit cuts off the target up to the first occurrence of [; the two consecutive & bits add a space to the result of [A] and the result of the LEFT bit that delivers A1 from the first char until [.
 
Upvote 0

Forum statistics

Threads
1,214,800
Messages
6,121,641
Members
449,044
Latest member
hherna01

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top