IF formula output not expected

LlebKcir

Board Regular
Joined
Oct 8, 2018
Messages
219
I am using 2 embedded IF statements in the attempt to produce either a string (cell&cell...) or a string with -SPARE are the end.

I know the inner IF statement works as expected. The result is setup to work on the FALSE, not TRUE for desired output.

My outer IF works when I do not include the inner IF, so I am guessing I have something out of alignment, or I am just not performing the correct embedded IF sequence.

Code:
=IF('Table'!F23="TRUE",IF($B$17="########",L56&"-BI"&M56&"-"&C56&"-SPARE",L56&"-BI"&M56&"-"&C56),L56&"-BI"&M56&"-"&C56&"-SPARE")

The inner
Code:
IF($B$17="########",L56&"-BI"&M56&"-"&C56&"-SPARE",L56&"-BI"&M56&"-"&C56)
Will string&-SPARE the line when cell B17 is full of # marks, else will populate with correct values.

The otter loop:
Code:
IF('Table'!F23="TRUE",L56&"-BI"&M56&"-"&C56,L56&"-BI"&M56&"-"&C56&"-SPARE")
Also will check correctly and either populate the string, or populate string&-SPARE as expected.

When I combine them the only output is string&-SPARE, that is not my desired outcome.

Thank you in advance for the help.
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
How about
=L56&"-BI"&M56&"-"&C56&IF(Table!F23=TRUE,IF($B$17="########","-SPARE",""),"-SPARE")
 
Upvote 0
The inner
Code:
IF($B$17="########",L56&"-BI"&M56&"-"&C56&"-SPARE",L56&"-BI"&M56&"-"&C56)
Will string&-SPARE the line when cell B17 is full of # marks, else will populate with correct values.

Really ? I find that hard to believe.
That formula tests whether B17 contains the text string "########", so should evaluate to FALSE if B17 contains the text strings "#######" or "#########" or "###" for example.
If B17 is really just full of #marks , that is usually an indication that B17 contains a number of some kind (perhaps a time or date) that Excel can not display correctly because the column width is too small.
And that can normally be addressed by making the column wider.
If that's what you mean, then
IF($B$17="########"
doesn't evaluate to TRUE in that situation.
 
Upvote 0
Fluffy, that was perfect. Not sure why changing the order like that works, but it is exactly what I was after.

Really ? I find that hard to believe.
That formula tests whether B17 contains the text string "########", so should evaluate to FALSE if B17 contains the text strings "#######" or "#########" or "###" for example.
If B17 is really just full of #marks , that is usually an indication that B17 contains a number of some kind (perhaps a time or date) that Excel can not display correctly because the column width is too small.
And that can normally be addressed by making the column wider.
If that's what you mean, then
IF($B$17="########"
doesn't evaluate to TRUE in that situation.

Higgins, yes I truly do me #### that is a bit of hard code we use on a reference worksheet to indicate null value for that cell. if that cell is null on the reference sheet we want the string&-SPARE on all sheets pointing to that value.
 
Upvote 0
The problem with your formula was that you had True in quotes which means it was looking for a text value, rather than a logical value.
I just took the opportunity to simplify the formula at the same time.
 
Upvote 0
I want to make sure I am following my error.

by having "TRUE" or "FALSE" that can lead to valuation errors as those are treated as text not Boolean logic values
Question, with text values could that lead to formulas not updating after a copy/paste value only?
 
Upvote 0
by having "TRUE" or "FALSE" that can lead to valuation errors as those are treated as text not Boolean logic values
That's right.
Copy/paste a values is fine, because the value will still be a boolean value, rather than text.
 
Upvote 0
Thank you, I will adjust my formulas and hopefully that will reduce the lack of updating I am seeing when I copy/paste values only. My formulas do not update currently with "TRUE"/"FALSE" unless I type the values in a 2nd time. very much defeats the reason for copy/paste values IMHO.

edit to add: Made the change from text to Boolean, poof problem solved.

Thank you again Fluffy
 
Last edited:
Upvote 0
You're welcome & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,223,711
Messages
6,174,025
Members
452,542
Latest member
Bricklin

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