Need help with IF statement

leopardhawk

Well-known Member
Joined
May 31, 2007
Messages
611
Office Version
  1. 2016
Platform
  1. Windows
Cell C1 has the name 'Bob' in it and cell D1 has the name 'Sue' in it (without quotes).

The formula below is returning 'Bob combined net income (before retirement)' just as it should and if C1 is blank, it is returning 'Name & Spouse/Partner combined net income (before retirement)'. This is all good.

I need help to modify the formula so that it returns both names, Bob & Sue, so that the result would be 'Bob & Sue combined net income (before retirement)'. I keep running into errors, maybe from the ampersand between the two names? Or from where I am placing the double-quotes? I would prefer to have the ampersand between the two names if possible. Could sure use some help.

Code:
=IF(C1=0,"Name & Spouse/Partner combined net income (before retirement)",C1&" combined net income (before retirement)")

Appreciate any advice.
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
Hi Leopardhawk,

if you have office 365 or latest Excel 2016 you can use the below formula:

Code:
=TEXTJOIN(" & ",TRUE,C1:D1)&" combined net income (before retirement)"
Cell C1 has the name 'Bob' in it and cell D1 has the name 'Sue' in it (without quotes).

The formula below is returning 'Bob combined net income (before retirement)' just as it should and if C1 is blank, it is returning 'Name & Spouse/Partner combined net income (before retirement)'. This is all good.

I need help to modify the formula so that it returns both names, Bob & Sue, so that the result would be 'Bob & Sue combined net income (before retirement)'. I keep running into errors, maybe from the ampersand between the two names? Or from where I am placing the double-quotes? I would prefer to have the ampersand between the two names if possible. Could sure use some help.


Appreciate any advice.
 
Last edited:
Upvote 0
Thanks for reaching out. I am running Excel 2016 and your formula is returning a #NAME error. I still need the IF statement for if/when C1 is blank so I appended your formula to the [value_if_false] part of my IF statement and I am receiving the same #NAME error.
 
Upvote 0
Try this one:

Code:
=IF(C1="","Name & Spouse/Partner combined net income (before retirement)",IF(D1<>"",C1& " & "&D1&" combined net income (before retirement)",C1& " combined net income (before retirement)"))

Thanks for reaching out. I am running Excel 2016 and your formula is returning a #NAME error. I still need the IF statement for if/when C1 is blank so I appended your formula to the [value_if_false] part of my IF statement and I am receiving the same #NAME error.
 
Upvote 0
Fantastic!!! Thank you so much! This works perfectly.

Cheers!
 
Upvote 0

Forum statistics

Threads
1,214,575
Messages
6,120,342
Members
448,956
Latest member
Adamsxl

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