Combine If statements

mbetsy

New Member
Joined
Aug 3, 2015
Messages
13
Happy New Year and thank you in advance.

I have 3 if statements which work individually but I don't do semi complex formula writing often enough to know how to do this properly.

If A1 is blank then concatenate this way, concatenate that way
If A1 is not blank and B1 is blank, then concatenate this way, concatenate that way
If A1 is not blank and B1 is not blank, then concatenate this way, concatenate that way

My concatenate formulas don't seem toe be the issue, true and false in a response would be understood.

Tks.
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
Something along the lines of
=IF(A1="","a1 is blank",IF(B1="", "a1 is not blank & b1 is blank","neither a1 nor b1 are blank"))
 
Upvote 0
Here are the 3 statements which work individually, which I would like to combine:

[TABLE="class: grid, width: 1000, align: left"]
<tbody>[TR]
[TD][/TD]
[TD][/TD]
[TD]C1[/TD]
[TD]D1[/TD]
[TD]E1[/TD]
[TD]F1[/TD]
[TD]G1[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD]=IF(ISBLANK(A2),IF(ISBLANK(B2),CONCATENATE(C1,G1),CONCATENATE("not what i want")))[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]A3[/TD]
[TD][/TD]
[TD]=IF(NOT(ISBLANK(A3)),IF(ISBLANK(B3),CONCATENATE(C1,F1,G1),CONCATENATE("not what i want")))[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]A4[/TD]
[TD]B4[/TD]
[TD]=IF(NOT(ISBLANK(A4)),IF(ISBLANK(B4),CONCATENATE(C1,D1,E1,F1,G1),CONCATENATE("not what i want")))[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]







Thank you.
 
Upvote 0
Can you show the expected outcome for each scenario?
 
Upvote 0
Thank you for sticking with me, Fluff.

[TABLE="class: grid, width: 1000, align: left"]
<tbody>[TR]
[TD][/TD]
[TD][/TD]
[TD]C1[/TD]
[TD]D1[/TD]
[TD]E1[/TD]
[TD]F1[/TD]
[TD]G1[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD]Desired Result: C1 G1[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]A3[/TD]
[TD][/TD]
[TD]Desired Result: C1 F1 G1[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]A4[/TD]
[TD]B4[/TD]
[TD]Desired Result: C1 E1 F1 G1[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]







Essentially, depending on the blank status of either A or B, pick up a different set of cells to concatenate. The three rules represent the 3 possible scenarios for my data.

/mbetsy
 
Upvote 0
Maybe,

In C2, copied down :

=CHOOSE(BIN2DEC(0+(A2<>"")&0+(B2<>""))+1,C$1&" "&G$1,"not what i want",C$1&" "&F$1&" "&G$1,C$1&" "&E$1&" "&F$1&" "&G$1)

Regards
Bosco
 
Upvote 0
Thank you, bosco. That does yield close to the desired result; adds an extra space between the cells. I have looked up the bin2dec function, but have had no occasion to use it. Can you explain the logic of the solution? Tks.
 
Upvote 0
Extract the BIN2DEC function part form the formula >>

>> BIN2DEC(0+(A2<>"")&0+(B2<>""))+1

This part >> 0+(A2<>"")&0+(B2<>"") generate 00, 01, 10 or 11

Then,

BIN2DEC(0+(A2<>"")&0+(B2<>""))+1 will give result 1, 2, 3 or 4 (being the Index number of the Choose function)

Regards
Bosco
 
Upvote 0
So the formula creates a value for an empty cell, then gives each permutation a unique value, and gives each permutation directions?

I have now successfully integrated this into my work, thank you very much.
 
Upvote 0

Forum statistics

Threads
1,223,885
Messages
6,175,181
Members
452,615
Latest member
bogeys2birdies

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