Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Excel =If(ISBLANK) with 4 columns

Posted on 2013-11-12
7
246 Views
Last Modified: 2013-11-16
Hi,

I have an existing formula in C that puts the number in Cell A into Cell C if B is blank. otherwise it puts B into C

What I need is a formula in Column D that puts A into D if B and C are blank, or puts B into D if C is blank, otherwise, it puts C into D.

In other words here is what should be in D for each row:

A    B      C      D
5                     5
5    6               6
      4               4
              3       3
2   3       1       1

It was easy with only 3 columns using =IF(ISBLANK(B121),A121,B121) but I haven't found an example using 4 columns.

Thanks in advance,

swjtx99
0
Comment
Question by:swjtx99
7 Comments
 
LVL 22

Assisted Solution

by:Flyster
Flyster earned 167 total points
ID: 39643630
Would a nested IF statement work for you:

=IF(B121&C121="",A121,IF(C121="",B121,C121))

Flyster
0
 
LVL 50

Expert Comment

by:Rgonzo1971
ID: 39643755
Hi,

With this formula you can have as many columns as you want
=INDEX(A2:C2,1,MAX((A2:C2<>"")*(COLUMN(A2:C2))))

Open in new window


Enter as Array Formula Ctrl-Shift-Enter

Regards
0
 
LVL 43

Expert Comment

by:Saqib Husain, Syed
ID: 39643822
If you do not like array formulas then try

=INDEX(A121:C121,LOOKUP(2,1/A121:C121,COLUMN(A121:C121)))
0
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 85

Assisted Solution

by:Rory Archibald
Rory Archibald earned 166 total points
ID: 39644169
If your data are all numeric:

=lookup(1E100,A1:D1)

and copy down.
0
 

Author Comment

by:swjtx99
ID: 39644766
Thanks for all the suggestions.

=IF(B121&C121="",A121,IF(C121="",B121,C121))

From Flyster - This one works.

=INDEX(A2:C2,1,MAX((A2:C2<>"")*(COLUMN(A2:C2))))

From Rgonzo Thanks but I can't use an array on this sheet

=INDEX(A121:C121,LOOKUP(2,1/A121:C121,COLUMN(A121:C121)))

From ssabqih works but when I start inserting columns and the column with the formula shifts (say from D to E) the formula breaks. Looks like it has something to do with the "LOOKUP(2,1/" part ?

=lookup(1E100,A1:D1)

From rorya. When I used it, it kept changing to =lookup(1E+100,A1:D1 and appeared to be summing all rows.
0
 
LVL 50

Accepted Solution

by:
barry houdini earned 167 total points
ID: 39644812
Rory's formula works for me. If you put the formula in E1

=LOOKUP(1E+100,A1:D1)

it will give you the last numeric value in A1:D1....which seems to be what you want

regards, barry
0
 

Author Closing Comment

by:swjtx99
ID: 39653209
Hi,

I did also find that Rory's formula works. As both Rory's and Flyster's seem to work equally well I have split the points.

Thanks very much for the assistance.

swjtx99
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa‚Ķ

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question