Incrementing numbers within a mid function and repeat until max number

VLD

New Member
Joined
Sep 13, 2011
Messages
2
I am performing an if function on the specific postions of a cell, in this example AD2. If any position =" " or ="$" I am returning that same position of another cell, W2. If the formula is false I am returning the same position of cell AD2. Below is the formula I have for the 1st postion:
=IF(OR(MID($AD2,1,1)="$",MID($AD2,1,1)=" "),MID($W2,1,1),MID($AD2,1,1))
I want to essentially repeat the formula within the cell 22 times by incrementing the position that is looked at in my if statement.
So to look at position 2 the statement would look like:
=IF(OR(MID($AD2,2,1)="$",MID($AD2,2,1)=" "),MID($W2,2,1),MID($AD2,2,1))
Is there a way for me to do this without having to rewrite this formula 22 times and concatenate it all together?
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
It would be very helpful if you posted some samples for AD2 and W2
along with the results you want to see based on those samples.
 
Upvote 0
Also, is it possible that there could be more than one "$" or " " character in each entry ? And if it is possible, what do you want to do ?
 
Upvote 0
Examples within ":
AD2:"$611"
W2:"60015500045VK81"

My desired output of the formula would be without the ":"66115500045VK81 "

I can live without the extra spaces at the end, but I know in any of these cells I could have a maximum of 22 alpha-numeric characters.
 
Upvote 0

Forum statistics

Threads
1,224,574
Messages
6,179,633
Members
452,933
Latest member
patv

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