Trying to nest formulas/put them all in one cell but keep getting "too many arguments" error?

Event2020

Board Regular
Joined
Jan 6, 2011
Messages
122
Office Version
  1. 2019
Platform
  1. Windows
Hi

I been working on this on and off for nearly 5 hours straight and when I look at the it everything just all blurs into a mess so I would be very grateful for a fresh perspective or pair of eyes.?

I am trying to combine the three formulas below in to one so that they are in the same Cell. Each formula performs a task depending on what is selected elsewhere in the worksheet and no matter what I do I keep getting the "too many arguments" error.

On their own each formula does exactly as I want.

I have tried the most obvious by nesting formula 2 inside formula 1's "value if false" area and then doing the same with formula 3 inside formula 2's "value if false" area but that did not work and I have tried different variations but everything I try throws a "too many arguments" error.

Here are the formulas in the order I would like them to run:
Formula 1.
Code:
=IF(AND(Add_CD_Information!B23=1,Add_CD_Information!B25=1),IF(Add_CD_Information!B48<>"",Add_CD_Information!B48,""),IF(AND(Add_CD_Information!B23={1},Add_CD_Information!B25={2}),CONCATENATE(Koolio_HTML!B158,Koolio_HTML!B159,Koolio_HTML!B160),""))

Formula 2.
Code:
=IF(Add_CD_Information!B23={3},Add_CD_Information!B48, "")

Formula 3
Code:
=IF(OR(Add_CD_Information!B23={2},Add_CD_Information!B23={4},Add_CD_Information!B23={5}),IF(Add_CD_Information!B48<>"",Add_CD_Information!B48,""),"")

I would be very grateful for any advice or help that you may be able to offer.
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
There's a lot of redundancy in those formulas. Try this:

Code:
=IF(AND(Add_CD_Information!B23=1,Add_CD_Information!B25=2),Koolio_HTML!B158&Koolio_HTML!B159&Koolio_HTML!B160,IF(OR(Add_CD_Information!B23={1,2,3,4,5}),Add_CD_Information!B48,""))&""

It's not exactly the same, if B25=3 the formulas will diverge, but if that's an issue let me know.
 
Upvote 0
There's a lot of redundancy in those formulas. Try this:

Code:
=IF(AND(Add_CD_Information!B23=1,Add_CD_Information!B25=2),Koolio_HTML!B158&Koolio_HTML!B159&Koolio_HTML!B160,IF(OR(Add_CD_Information!B23={1,2,3,4,5}),Add_CD_Information!B48,""))&""

It's not exactly the same, if B25=3 the formulas will diverge, but if that's an issue let me know.

Hi Eric

How on earth did you manage to condense my original formulas down into a single short one, I am in awe?

I have done a very quick test and it seems to work perfectly but I will test it more thoroughly tomorrow.

Just from looking at your formula I honestly can not see how you did it.

Thank you so much, I really appreciate your help.

Kind regards

Kenneth
 
Upvote 0
Well, it took a few passes. That was about the third iteration. I found one thing to combine, and looked at the result and found something else to change. The &"" on the end was key to removing a lot of If xx="","" sections. I hope at least you can figure out how it works now though!

Glad I could help! :cool:
 
Upvote 0

Forum statistics

Threads
1,223,897
Messages
6,175,270
Members
452,628
Latest member
dd2

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