Parse text with a keyword "else"

jrosen12

New Member
Joined
Aug 10, 2018
Messages
7
Hi,

I am trying to parse a string beginning at the word "else" and ending at a number.

if(LowIncomeSubsidyLevel = 1) then 27.00 else (if(LowIncomeSubsidyLevel=0.75) then 33.40 else (if( LowIncomeSubsidyLevel=0.50) then 39.80 else (if(LowIncomeSubsidyLevel=0.25) then 46.30 else 52.70)))

The results should be parsed as:

else (if(LowIncomeSubsidyLevel=0.75) then 33.40
else (if( LowIncomeSubsidyLevel=0.50) then 39.80
else (if(LowIncomeSubsidyLevel=0.25) then 27.00
else 52.70)))

I have been using the MID formula with somewhat success.
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
Hi,

You didn't specify whether you want the results in separate Columns or Rows, I've assumed Rows, otherwise, formula will need modification:


Book1
A
1if(LowIncomeSubsidyLevel = 1) then 27.00 else (if(LowIncomeSubsidyLevel=0.75) then 33.40 else (if( LowIncomeSubsidyLevel=0.50) then 39.80 else (if(LowIncomeSubsidyLevel=0.25) then 46.30 else 52.70)))
2else (if(LowIncomeSubsidyLevel=0.75) then 33.40
3else (if( LowIncomeSubsidyLevel=0.50) then 39.80
4else (if(LowIncomeSubsidyLevel=0.25) then 46.30
5else 52.70)))
Sheet341
Cell Formulas
RangeFormula
A2=TRIM(MID(SUBSTITUTE(A$1," else",REPT(" ",255)&"else"),ROWS(A$2:A2)*255,255))


Formula copied down.
 
Upvote 0

Forum statistics

Threads
1,223,228
Messages
6,170,875
Members
452,363
Latest member
merico17

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