Building an IF statement??

rogster001

New Member
Joined
Jun 17, 2010
Messages
45
Hi all,

I have a range of cells that at present are populated with a transpose array, that simple pulls data from another worksheet in the same file, so i have the formula:

Code:
{=TRANSPOSE(NEall!C30:BB30)}

This works fine.

However we would like to have the values that are ' 0 ' show as a small text string " n/a " for example.

Can we combine the transpose() into a larger function description that would do something like the following pseudoCode:

Code:
{ TRANSPOSE(NEall!30:BB30)
if(cellVal == 0)
{
     print "n\a";
}
}

I have little idea how to build up formula descriptions in excel, apart from very simple combinations of things, but i am a fluent C++ coder so hopefully will be able to grasp any replies!

Many thanks for any info.
 

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.
Ok thanks, i see what you mean..

I wonder if you could advise on the syntax i looked for in any case though? I just tried this with some sample data and it worked fine

Code:
IF(G24:G45,1, "n\a")

But I don't know how to combine it in a statement with this:

Code:
{=TRANSPOSE(Sheet1!N22:AI22) }CODE]
 
i tried this first off:
 
[CODE]{=TRANSPOSE(Sheet1!N22:AI22) IF(G24:G45,1, "n\a") }

But that syntax was wrong, i can continue fiddling here but wondereed if anybody could advise on the general rule of syntax for combining terms in a formula?

Cheers!
 
Upvote 0
{=IF(TRANSPOSE(Sheet3!$A$1:$E$7)=0,"N/A",TRANSPOSE(Sheet3!$A$1:$E$7))}

The problem with doing it that way is that if the response is zero, a text string is entered instead of a number which can lead to problems later with some functions which need to sum data, if you use them. Using my method, the value stored in the cell remains 0, it just looks like a text string "n/a".
 
Upvote 0
the number format is a nice fix thanks, and i see what you mean, you just want the cells 'represented' differently,

i used:

0.00; - 0.00; "n\a"
as i require 2 decimal places, was very pleased to see that work haah!

Is any kind of call to something like TEXTCOLOR I could use? To have the "n\a" appear as light grey for example?

Code:
0.00; - 0.00; "n\a" (TEXTCOLOR 25)

Anything like that exist?

I tried this but whilst it did not complain about the syntax, it did not change text color
Code:
0.00; - 0.00; "n\a";[Red]

EDIT!

I got it!

Code:
0.00; - 0.00;[Red] "n\a"

Now i just need to know the colour codes or stringvalues for 'lightGrey' !
 
Last edited:
Upvote 0
Use conditional formatting. If you are in Excel 2007, it's on the Home ribbon, under styles. Just format 0 how you want it to appear as, even though it shows "n/a" it is still a 0 to the computer, as I have already shown.
 
Upvote 0
The problem with your number format is that you put the colour indication after another semi-colon. The basic rules for number formatting are as follows:

Postitive numbers ; Negative numbers ; Zero ; Text strings

So, to make the N/A red, you should have used:

Code:
0.00;-0.00;[red]"N/A"

The list of colours that can be supported in this way is, however, very limited. If you want more control, conditional formatting is your baby.
 
Upvote 0
Grat thanks, i have that fixed up now, but i need to apply the same thing for

if a number is exactly -100
my problem is the above and variants i have tried do not seem to work, my column contains figures that are other minus numbers, they too get changed or messaed about with by the ways i have tried so far,
so what would be the command required to isolate a single minus value in this way?

thanks a lot
 
Upvote 0
How many numbers do you need to isolate?

This would work for the question, returning the text string response:

{=IF(TRANSPOSE(Sheet3!$A$1:$E$7)=-100,"Too Small",IF(TRANSPOSE(Sheet3!$A$1:$E$7)=0,"N/A",TRANSPOSE(Sheet3!$A$1:$E$7)))}

This would work for the number formatting response:

[=-100]"Too Small";[=0]"N/A";0.00
 
Upvote 0
Thats brilliant mate, thanks for the help..it is any -100 value found in the given column by the way, so i am going with the number formatting option, cheers!
 
Upvote 0

Forum statistics

Threads
1,224,505
Messages
6,179,152
Members
452,891
Latest member
JUSTOUTOFMYREACH

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