Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 42
Default Find previous number and find next number in column

In Excel 2007, in column C I have some cells that contain numbers and some
cells that are blank. In column D, for every blank cell in column C I need
to return the cell reference of the previous cell containing a number. For
instance, if C10 is 5, c11 is blank, and c12 is blank, then i need d11 to
return "$C$10" and I need d12 to also return "$C$10". D10 should be blank
since C10 contained a number.

In column E, I need to do the same thing except I need the next non-blank
cell returned rather than the previous.
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,104
Default Find previous number and find next number in column

In D2 enter =IF(C2="",IF(D1="",CELL("address",C1),D1),"")
Copy down the column
I'll let you do Part 2 <grin
best wishes
--
Bernard V Liengme
Microsoft Excel MVP
http://people.stfx.ca/bliengme
remove caps from email

"DoubleZ" wrote in message
...
In Excel 2007, in column C I have some cells that contain numbers and some
cells that are blank. In column D, for every blank cell in column C I
need
to return the cell reference of the previous cell containing a number.
For
instance, if C10 is 5, c11 is blank, and c12 is blank, then i need d11 to
return "$C$10" and I need d12 to also return "$C$10". D10 should be blank
since C10 contained a number.

In column E, I need to do the same thing except I need the next non-blank
cell returned rather than the previous.



  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default Find previous number and find next number in column

We can do it in two steps:
In D1 enter:
=ADDRESS(ROW(C1),COLUMN(C1))
In D2 enter:
=IF(C2="",D1,ADDRESS(ROW(C2),COLUMN(C2))) and copy down

Here is an example of what we see:

3 $C$1
2 $C$2
$C$2
11 $C$4
$C$4
$C$4
1 $C$7
2 $C$8
3 $C$9
$C$9
4 $C$11
5 $C$12
6 $C$13
$C$13
7 $C$15
$C$15
8 $C$17

Not quite there because the cells in D next to filled cells in C should
appear empty. The next step is to make the D cells adjacent to the filled C
cells appear empty.

Click on D1 and assign Conditional formatting:
FormulaIs:
=B1<"" and pick the font color to match the background color.
Copy the formatting down the column. What we now see is:

3
2
$C$2
11
$C$4
$C$4
1
2
3
$C$9
4
5
6
$C$13
7
$C$15
8


--
Gary''s Student - gsnu200836


"DoubleZ" wrote:

In Excel 2007, in column C I have some cells that contain numbers and some
cells that are blank. In column D, for every blank cell in column C I need
to return the cell reference of the previous cell containing a number. For
instance, if C10 is 5, c11 is blank, and c12 is blank, then i need d11 to
return "$C$10" and I need d12 to also return "$C$10". D10 should be blank
since C10 contained a number.

In column E, I need to do the same thing except I need the next non-blank
cell returned rather than the previous.

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,805
Default Find previous number and find next number in column

Are you open to working with helper columns?
If yes then try this
Enter the formulas (including the = sign) below in the cells indicated;
D1=IF(C1="",CELL("address",C1),"")
E1=D1
F1=IF(C1<"",CELL("address",C1),"")
G1=IF(F1="",F1,"")

D2=IF(C2="",CELL("address",C1),"")
E2=IF(AND(C2="",D1=""),D2,"")
F2=IF(C2<"",CELL("address",C2),"")
G2=IF(AND(F2="",G1=""),F3,"")
and copy down...

Col E and F will have what you want...
Note: I have done limited testing so it may not work...

"DoubleZ" wrote:

In Excel 2007, in column C I have some cells that contain numbers and some
cells that are blank. In column D, for every blank cell in column C I need
to return the cell reference of the previous cell containing a number. For
instance, if C10 is 5, c11 is blank, and c12 is blank, then i need d11 to
return "$C$10" and I need d12 to also return "$C$10". D10 should be blank
since C10 contained a number.

In column E, I need to do the same thing except I need the next non-blank
cell returned rather than the previous.

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 42
Default Find previous number and find next number in column

Thanks to all of you for your help.

"Sheeloo" wrote:

Are you open to working with helper columns?
If yes then try this
Enter the formulas (including the = sign) below in the cells indicated;
D1=IF(C1="",CELL("address",C1),"")
E1=D1
F1=IF(C1<"",CELL("address",C1),"")
G1=IF(F1="",F1,"")

D2=IF(C2="",CELL("address",C1),"")
E2=IF(AND(C2="",D1=""),D2,"")
F2=IF(C2<"",CELL("address",C2),"")
G2=IF(AND(F2="",G1=""),F3,"")
and copy down...

Col E and F will have what you want...
Note: I have done limited testing so it may not work...

"DoubleZ" wrote:

In Excel 2007, in column C I have some cells that contain numbers and some
cells that are blank. In column D, for every blank cell in column C I need
to return the cell reference of the previous cell containing a number. For
instance, if C10 is 5, c11 is blank, and c12 is blank, then i need d11 to
return "$C$10" and I need d12 to also return "$C$10". D10 should be blank
since C10 contained a number.

In column E, I need to do the same thing except I need the next non-blank
cell returned rather than the previous.

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
find first positive number in column Sheila D Excel Discussion (Misc queries) 7 August 11th 08 07:08 PM
Count to find the number of 100% 90% 80% in a column % Count Excel Discussion (Misc queries) 7 June 3rd 08 10:24 PM
Find max Row() number for a value in column Vlado Sveda Excel Worksheet Functions 12 January 20th 07 05:32 PM
How do I find the last number in a column of numbers? Shyam Excel Worksheet Functions 2 August 26th 05 03:05 AM
How do I find the first value in a column less than a number? redeucer Excel Worksheet Functions 6 November 4th 04 09:59 PM


All times are GMT +1. The time now is 09:53 PM.

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"