# Combine If statements

#### mbetsy

##### New Member
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

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off

#### Fluff

##### MrExcel MVP, Moderator
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"))

#### mbetsy

##### New Member
Here are the 3 statements which work individually, which I would like to combine:

 C1 D1 E1 F1 G1 =IF(ISBLANK(A2),IF(ISBLANK(B2),CONCATENATE(C1,G1),CONCATENATE("not what i want"))) A3 =IF(NOT(ISBLANK(A3)),IF(ISBLANK(B3),CONCATENATE(C1,F1,G1),CONCATENATE("not what i want"))) A4 B4 =IF(NOT(ISBLANK(A4)),IF(ISBLANK(B4),CONCATENATE(C1,D1,E1,F1,G1),CONCATENATE("not what i want")))

<tbody>
</tbody>

Thank you.

#### Fluff

##### MrExcel MVP, Moderator
Can you show the expected outcome for each scenario?

#### mbetsy

##### New Member
Thank you for sticking with me, Fluff.

 C1 D1 E1 F1 G1 Desired Result: C1 G1 A3 Desired Result: C1 F1 G1 A4 B4 Desired Result: C1 E1 F1 G1

<tbody>
</tbody>

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

#### bosco_yip

##### Well-known Member
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

#### mbetsy

##### New Member
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.

#### bosco_yip

##### Well-known Member
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

#### mbetsy

##### New Member
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.

1,095,234
Messages
5,443,273
Members
405,222
Latest member
Summer01

### This Week's Hot Topics

• Copy entire row if CountA <>0 to another sheet
[B]I want to copy entire row if CountA <>0 for column J7:AM7 (headers on J6:AM6) and so on till the last used cell is column D and paste the...
• Select last used Row in Table
I have created a Table in a Worksheet which is locked to prevent user errors and protect formula. Some of the cells require freetext entries which...
• excel workbook: do not allow certain file name
Hello all, Don't think this has ever been asked before, but how do I restrict file save [Before_Save Event] if the name of the file being saved...
• fixing problem autofilter
hello i need help about my code when i search by code in textbox it doesn't show anything this is my data [ATTACH type="full"...
• “Weight”
Hi, i’ve got a long sheet filled with weights such as kg,g,L & ml. i can build a formula to convert kg into g and liter into ml. How ever, my...
• How to capitalize everything before a certain character?
In column A, I have some text: Hello good day.mp3 Hello good day.flac etc. I'd like to capitalize everything before the period. I don't need the...