Four answers in one formula?

bpflyr

Board Regular
Joined
Nov 7, 2005
Messages
116
Sorry, I just posted a question very similar to this, but I had not thought it all the way through. Here's what I'm trying to do in one formula:

IF LEN(J138)=0, then return F138
IF LEN(J138)>0, then SUM(E138-J138). IF that result is 0, then be blank.
IF LEN(F138)=0, then be blank

Thank you!!
 

Some videos you may like

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.

nbrcrunch

Well-known Member
Joined
Jan 1, 2003
Messages
2,062
Sounds like your last criteria is actually your first.

You almost wrote out verbatim what the formula would look like.

=if(len(f138)=0,"",if(len(J138)=0,F138,if(len(J138)>0,sum(E138:J138),"")))

the basic construct of IF in Excel is:

IF(condition, true-result, false-result)

You can "nest" up to 6 or 7 different IF statement. (Forget the actual number).
 

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
76,052
Office Version
  1. 365
Platform
  1. Windows
bpflyr

Could you try and stick to 1 thread?

I know this one is slighty different but they are related.
 

Yogi Anand

MrExcel MVP
Joined
Mar 12, 2002
Messages
11,454
Hi bpflyr:

It is not a good idea to start another thread on the same type of question. Anyway, how about ...

=IF(F138=0,"",IF(LEN(J138)=0,F138,IF(E138-J138,E138-J138,"")))
 

Aladin Akyurek

MrExcel MVP
Joined
Feb 14, 2002
Messages
85,201
bpflyr said:
Sorry, I just posted a question very similar to this, but I had not thought it all the way through. Here's what I'm trying to do in one formula:

IF LEN(J138)=0, then return F138
IF LEN(J138)>0, then SUM(E138-J138). IF that result is 0, then be blank.
IF LEN(F138)=0, then be blank

Thank you!!

=IF(J138="",IF(F138="","",F138),IF(E138-J138,E138-J138,""))
 

bpflyr

Board Regular
Joined
Nov 7, 2005
Messages
116
Thank you so much to everybody. Sorry about the new thread.

bpflyr
 

Watch MrExcel Video

Forum statistics

Threads
1,118,283
Messages
5,571,303
Members
412,380
Latest member
Angelagrace
Top