Manage Long Formulas

awalle

Board Regular
Joined
Jul 12, 2006
Messages
56
Hi, there

I know this has been post before, but I forgot how to do this simple task. (maybe my friends "Alz" and "heimer" come today with me :rolleyes: ).

I need to manage a long formula in a single Cell :

=if(trim(G2)<>"",IF(iserr(FIND("G",G2)),G2,IF(FIND("-",G2)>0,MID(G2,FIND("-",G2)-5,FIND(" ",G2,FIND("-",G2))-FIND("-",G2)+5)),IF(iserr(FIND("G",H2)),H2,IF(FIND("-",H2)>0,MID(H2,FIND("-",H2)-5,FIND(" ",H2,FIND("-",H2))-FIND("-",H2)+5)))))

Obviously the excel gave me a "Too many argument" error,

Can somebody refresh my memory??? :LOL:


Thanks in advance.
AWalle
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
Is this what you're going for?

=IF(TRIM(G2)<>"",IF(ISERR(FIND("G",G2)),G2,IF(FIND("-",G2)>0,MID(G2,FIND("-",G2)-5,FIND(" ",G2,FIND("-",G2))-FIND("-",G2)+5))),IF(ISERR(FIND("G",H2)),H2,IF(FIND("-",H2)>0,MID(H2,FIND("-",H2)-5,FIND(" ",H2,FIND("-",H2))-FIND("-",H2)+5))))

It looks like you moved an argument over somewhere from the first IF

=if(trim(G2)<>"",IF(iserr(FIND("G",G2)),G2,IF(FIND("-",G2)>0,MID(G2,FIND("-",G2)-5,FIND(" ",G2,FIND("-",G2))-FIND("-",G2)+5)),IF(iserr(FIND("G",H2)),H2,IF(FIND("-",H2)>0,MID(H2,FIND("-",H2)-5,FIND(" ",H2,FIND("-",H2))-FIND("-",H2)+5)))))

<--the "if-false" argument is missing from the first IF statement. I kind of guessed what you wanted, but it looks like might have swept that argument inside one of the nested ifs.
 
Upvote 0
You seem to have one to many closing parenthises in your formula...

Try:

=IF(TRIM(G2)<>"",IF(ISERR(FIND("G",G2)),G2,IF(FIND("-",G2)>0,MID(G2,FIND("-",G2)-5,FIND(" ",G2,FIND("-",G2))-FIND("-",G2)+5),IF(ISERR(FIND("G",H2)),H2,IF(FIND("-",H2)>0,MID(H2,FIND("-",H2)-5,FIND(" ",H2,FIND("-",H2))-FIND("-",H2)+5))))),"")

Also, I added a Value-if-False qualifier of "" for the original condition IF(Trim(G2)<>"",... so that you will get a blank if that is false....

you might want to test all possibilities to ensure the formula is doing its job correctly.
 
Upvote 0
I'am sorry folks there was an error in the formula, I missed one part of it.

Sorry I already correct it.

Thanks
 
Upvote 0

Forum statistics

Threads
1,214,861
Messages
6,121,969
Members
449,059
Latest member
oculus

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