Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
Sal Sal is offline
external usenet poster
 
Posts: 84
Default Return value of a non blank cell

Hi,

I am looking for a formula that will examine cells E4:N4 and return the
value of the one cell that is not blank in that range to cell P4.

Any ideas?

Thanks
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default Return value of a non blank cell

=MAX(E4:N4)

if all are blank except one cell
--
Gary''s Student - gsnu200736


"Sal" wrote:

Hi,

I am looking for a formula that will examine cells E4:N4 and return the
value of the one cell that is not blank in that range to cell P4.

Any ideas?

Thanks

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 15,768
Default Return value of a non blank cell

What type of data is it? Is it text or a number or can it be either?

--
Biff
Microsoft Excel MVP


"Sal" wrote in message
...
Hi,

I am looking for a formula that will examine cells E4:N4 and return the
value of the one cell that is not blank in that range to cell P4.

Any ideas?

Thanks



  #4   Report Post  
Posted to microsoft.public.excel.misc
Sal Sal is offline
external usenet poster
 
Posts: 84
Default Return value of a non blank cell

Thanks,

If I wanted to go one step further and say now give me the column heading of
the cell that contains a value.

Eg if the formula returns a value of 10 then how can I get Excel to tell me
what the column heading is of 10 ie which product code?

Thanks


"Gary''s Student" wrote:

=MAX(E4:N4)

if all are blank except one cell
--
Gary''s Student - gsnu200736


"Sal" wrote:

Hi,

I am looking for a formula that will examine cells E4:N4 and return the
value of the one cell that is not blank in that range to cell P4.

Any ideas?

Thanks

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default Return value of a non blank cell

=INDEX(E1:N4,1,MATCH(MAX(E4:N4),E4:N4))

the MATCH gives us the column
the INDEX gives us the content of row 1 for that column
--
Gary''s Student - gsnu200736


"Sal" wrote:

Thanks,

If I wanted to go one step further and say now give me the column heading of
the cell that contains a value.

Eg if the formula returns a value of 10 then how can I get Excel to tell me
what the column heading is of 10 ie which product code?

Thanks


"Gary''s Student" wrote:

=MAX(E4:N4)

if all are blank except one cell
--
Gary''s Student - gsnu200736


"Sal" wrote:

Hi,

I am looking for a formula that will examine cells E4:N4 and return the
value of the one cell that is not blank in that range to cell P4.

Any ideas?

Thanks



  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default Return value of a non blank cell

You raise a good point. If it could be either, I would run back to VBA:

Function nblank(r As Range)
For Each rr In r
If Len(rr.Value) 0 Then
nblank = rr.Value
Exit Function
End If
Next
nblank = ""
End Function

--
Gary''s Student - gsnu200736


"T. Valko" wrote:

What type of data is it? Is it text or a number or can it be either?

--
Biff
Microsoft Excel MVP


"Sal" wrote in message
...
Hi,

I am looking for a formula that will examine cells E4:N4 and return the
value of the one cell that is not blank in that range to cell P4.

Any ideas?

Thanks




  #7   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 15,768
Default Return value of a non blank cell

The reason I asked is that to a lot of folks "value" means number but to me
"value" means anything: text, number, logicals, errors.

Rather than suggest a generic formula like this that works for both text or
numbers:

=INDEX(A1:E1,MATCH(TRUE,INDEX(A1:E1<"",,0),0))

If you know the specific data type you can use a shorter formula:

For example:

For numbers (your suggestion):

=MAX(A1:E1)

For text (assuming there are no formula blanks):

=INDEX(A1:E1,MATCH("*",A1:E1,0))

For text and excluding formula blanks:

=HLOOKUP("?*",A1:E1,1,0)

--
Biff
Microsoft Excel MVP


"Gary''s Student" wrote in message
...
You raise a good point. If it could be either, I would run back to VBA:

Function nblank(r As Range)
For Each rr In r
If Len(rr.Value) 0 Then
nblank = rr.Value
Exit Function
End If
Next
nblank = ""
End Function

--
Gary''s Student - gsnu200736


"T. Valko" wrote:

What type of data is it? Is it text or a number or can it be either?

--
Biff
Microsoft Excel MVP


"Sal" wrote in message
...
Hi,

I am looking for a formula that will examine cells E4:N4 and return the
value of the one cell that is not blank in that range to cell P4.

Any ideas?

Thanks






  #8   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 15,768
Default Return value of a non blank cell

For text (assuming there are no formula blanks):
=INDEX(A1:E1,MATCH("*",A1:E1,0))


Even shorter:

=HLOOKUP("*",A1:E1,1,0)


--
Biff
Microsoft Excel MVP


"T. Valko" wrote in message
...
The reason I asked is that to a lot of folks "value" means number but to
me "value" means anything: text, number, logicals, errors.

Rather than suggest a generic formula like this that works for both text
or numbers:

=INDEX(A1:E1,MATCH(TRUE,INDEX(A1:E1<"",,0),0))

If you know the specific data type you can use a shorter formula:

For example:

For numbers (your suggestion):

=MAX(A1:E1)

For text (assuming there are no formula blanks):

=INDEX(A1:E1,MATCH("*",A1:E1,0))

For text and excluding formula blanks:

=HLOOKUP("?*",A1:E1,1,0)

--
Biff
Microsoft Excel MVP


"Gary''s Student" wrote in
message ...
You raise a good point. If it could be either, I would run back to VBA:

Function nblank(r As Range)
For Each rr In r
If Len(rr.Value) 0 Then
nblank = rr.Value
Exit Function
End If
Next
nblank = ""
End Function

--
Gary''s Student - gsnu200736


"T. Valko" wrote:

What type of data is it? Is it text or a number or can it be either?

--
Biff
Microsoft Excel MVP


"Sal" wrote in message
...
Hi,

I am looking for a formula that will examine cells E4:N4 and return
the
value of the one cell that is not blank in that range to cell P4.

Any ideas?

Thanks







  #9   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 136
Default Return value of a non blank cell

When no headings needed, how about:

=CONCATENATE(A1,B1,C1,D1,E1)

Will give you text, numbers, logical, error

"Gary''s Student" wrote:

=MAX(E4:N4)

if all are blank except one cell
--
Gary''s Student - gsnu200736


"Sal" wrote:

Hi,

I am looking for a formula that will examine cells E4:N4 and return the
value of the one cell that is not blank in that range to cell P4.

Any ideas?

Thanks

  #10   Report Post  
Posted to microsoft.public.excel.misc
Sal Sal is offline
external usenet poster
 
Posts: 84
Default Return value of a non blank cell

Thank you all for your responses - will give them all a try.

In answer to your question, the row information (where I am looking for non
blanks) is a numeric value and the column header I am after is text.

Thank you all very much for your time.


  #11   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 7
Default Return value of a non blank cell

is this applicable for dates too? I'm looking at range in a row say n2:r2,
if there is a non blank cell with a date then I want it to populate in q2.
Can anyone help please?
thanks
--
Afia


"Gary''s Student" wrote:

=MAX(E4:N4)

if all are blank except one cell
--
Gary''s Student - gsnu200736


"Sal" wrote:

Hi,

I am looking for a formula that will examine cells E4:N4 and return the
value of the one cell that is not blank in that range to cell P4.

Any ideas?

Thanks

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
I want to return the #VALUE! as a blank cell. kgb1953 Excel Worksheet Functions 1 April 15th 07 06:20 PM
If cell blank return a blank Angela1979 Excel Worksheet Functions 8 March 7th 07 01:18 PM
Return a value to a cell that is blank hilltop55 Excel Discussion (Misc queries) 2 February 1st 07 08:58 PM
return a blank cell jpotts8117 Excel Worksheet Functions 5 September 23rd 05 08:33 PM
return zero from a blank cell Eric Excel Worksheet Functions 5 July 15th 05 11:23 PM


All times are GMT +1. The time now is 10:08 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"