Help!!! Nested IF Statement limitation

trenier

New Member
Joined
Feb 20, 2014
Messages
22
Greetings,

I have a nested IF statement that I am using in an application I am building in Excel. I am using logic to get the current month and then evaluate whether the value is a number. I would like to know if there is a better way to perform what I am trying to accomplish using another function. I am trying to cocantonate the the statements together which has worked in the past but not for this particular function. Your help is greatly appreciated. See Below... The function works if i use 7 IF statements.


=IF(I3="Jan",IF(ISNUMBER(SEARCH("NA",Data!$B$355)),"NA",Data!$B$355),IF(I3="Feb",IF(ISNUMBER(SEARCH("NA",Data!$C$355)),"NA",Data!$C$355),IF(I3="Mar",IF(ISNUMBER(SEARCH("NA",Data!$D$355)),"NA",Data!$D$355),IF(I3="Apr",IF(ISNUMBER(SEARCH("NA",Data!$E$355)),"NA",Data!$E$355))))) + IF(I3="May",IF(ISNUMBER(SEARCH("NA",Data!$F$355)),"NA",Data!$F$355),IF(I3="Jun",IF(ISNUMBER(SEARCH("NA",Data!$G$355)),"NA",Data!$G$355),IF(I3="Jul",IF(ISNUMBER(SEARCH("NA",Data!$H$355)),"NA",Data!$H$355),IF(I3="Aug",IF(ISNUMBER(SEARCH("NA",Data!$I$355)),"NA",Data!$I$355),IF(I3="Sep",IF(ISNUMBER(SEARCH("NA",Data!$J$355)),"NA",Data!$J$355)))))) + IF(I3="Oct",IF(ISNUMBER(SEARCH("NA",Data!$K$355)),"NA",Data!$K$355),IF(I3="Nov",IF(ISNUMBER(SEARCH("NA",Data!$L$355)),"NA",Data!$L$355),IF(I3="Dec",IF(ISNUMBER(SEARCH("NA",Data!$M$355)),"NA",Data!$M$355))))

Cheers,

Todd
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
Greetings,

I have a nested IF statement that I am using in an application I am building in Excel. I am using logic to get the current month and then evaluate whether the value is a number. I would like to know if there is a better way to perform what I am trying to accomplish using another function. I am trying to cocantonate the the statements together which has worked in the past but not for this particular function. Your help is greatly appreciated. See Below... The function works if i use 7 IF statements.




=IF(I3="Jan",IF(ISNUMBER(SEARCH("NA",Data!$B$355)),"NA",Data!$B$355),IF(I3="Feb",IF(ISNUMBER(SEARCH("NA",Data!$C$355)),"NA",Data!$C$355),IF(I3="Mar",IF(ISNUMBER(SEARCH("NA",Data!$D$355)),"NA",Data!$D$355),IF(I3="Apr",IF(ISNUMBER(SEARCH("NA",Data!$E$355)),"NA",Data!$E$355))))) + IF(I3="May",IF(ISNUMBER(SEARCH("NA",Data!$F$355)),"NA",Data!$F$355),IF(I3="Jun",IF(ISNUMBER(SEARCH("NA",Data!$G$355)),"NA",Data!$G$355),IF(I3="Jul",IF(ISNUMBER(SEARCH("NA",Data!$H$355)),"NA",Data!$H$355),IF(I3="Aug",IF(ISNUMBER(SEARCH("NA",Data!$I$355)),"NA",Data!$I$355),IF(I3="Sep",IF(ISNUMBER(SEARCH("NA",Data!$J$355)),"NA",Data!$J$355)))))) + IF(I3="Oct",IF(ISNUMBER(SEARCH("NA",Data!$K$355)),"NA",Data!$K$355),IF(I3="Nov",IF(ISNUMBER(SEARCH("NA",Data!$L$355)),"NA",Data!$L$355),IF(I3="Dec",IF(ISNUMBER(SEARCH("NA",Data!$M$355)),"NA",Data!$M$355))))

Cheers,

Todd

Show us the data!!!
 
Upvote 0
If I understand correctly what you want, maybe this can helps:

Code:
=IF(COUNT(SEARCH("NA",OFFSET(Data!$B$355,,MONTH(I3&14)-1))),"NA",OFFSET(Data!$B$355,,MONTH(I3&14)-1))

Markmzz
 
Upvote 0
Thanks Denward. I am new to writing some of these Excel functions. Could you give me an example of what you mean? I appreciate your help.

Todd
 
Upvote 0
Hi Mark,

I3 points to a cell that gets the current Month. Some of the fields have NA in them. I am open to any suggestions you have as I am new to writing functions in Excel.

Todd
 
Upvote 0
maybe you should post a sample file
what is in Data!$B$355 text with na word
 
Upvote 0
i just ask since you can do it like this if the I3 is a real date

I3 = 1/1/2014
=index(
Data!$B$355:$M$355,month(I3))

i'm just confused why the search
IF(ISNUMBER(SEARCH("NA",Data!$B$355)),"NA",Data!$B$355) why not just return what is in B355

 
Upvote 0

Is it something like:
Rich (BB code):
=LOOKUP(9.99999999999999E+307,
  SEARCH({"jan',"feb","mar","apr","may","jun","jul","aug",
    "sep","oct","nov","dec"},I3),
  Data!$B$355:$M$355)
what you are after?

If so, you can create a range housing the month names and naming this range as MonthList and replace the above formula with:
Rich (BB code):
=LOOKUP(9.99999999999999E+307,SEARCH(MonthList,I3),Data!$B$355:$M$355)
 
Upvote 0
I3 contains just the current Month such as "Jan" "Feb". I need to extract the data from the source worksheet. Jan, Feb are headings in the source worksheet. Users enter NA in the fields when they do not have a value. I3 contains the current month. I need to retrive values for a particular month that are arranged in columns for a particular business metric.

Sorry my skills in Excel in this area are not strong.


Thanks for everyones help on this!

Todd
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,584
Messages
6,120,387
Members
448,956
Latest member
JPav

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