Advanced text function (combining text)

J

Johan

Excel 2000 without add-ons
I have two cells that contains text cell1:"20/30" and cell2: "45/100"
I would like two formulas that combines the first part, or the second
part of the cells and gives me the result "20/45"and in another cell
"30/100"
This I could do with the formulas
=LEFT(cell1,2)&"/"& LEFT(cell2,2)
And
=RIGHT(cell1,2)&"/"& RIGHT(cell2,3)

The problem I have is that the cells I would like to combine can have
different number of characters for example "1/50" and "33/888" In this
case I would like the result "1/33" and "50/888"
There can be minimum" 0/10 and 0/100" and maximum "99/99 and 999/999"
in the cells I would like to combine.

Can anyone help me with the two formulas that I'm looking for?

Thanks!
 
N

ND Pard

Assume:
cell a2 contains the text 1/33

cell B2 contains the text 33/888

To obtain your desired results enter the following formula in a blank cell:

=""&LEFT(A1,FIND("/",A1,1))&LEFT(B1,FIND("/",B1,1)-1)

In another blank cell enter the formula:

=""&MID(A1,FIND("/",A1,1)+1,100)&MID(B1,FIND("/",B1,1),100)

I used 100 as the last paramater of the Mid Function; however, if your
largest number is three (3) characters in length, you could replace it with
3. Either way, you'll get the same results.

I hope that helps. Good Luck.
 
N

ND Pard

Oops ... typo err ... try this:
Assume:
cell A1 contains the text 1/33

cell B1 contains the text 33/888

To obtain your desired results enter the following formula in a blank cell:

=""&LEFT(A1,FIND("/",A1,1))&LEFT(B1,FIND("/",B1,1)-1)

In another blank cell enter the formula:

=""&MID(A1,FIND("/",A1,1)+1,100)&MID(B1,FIND("/",B1,1),100)

I used 100 as the last paramater of the Mid Function; however, if your
largest number is three (3) characters in length, you could replace it with
3. Either way, you'll get the same results.

I hope that helps. Good Luck.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top