User not logged in - login - register
Home Calendar Books School Tool Photo Gallery Message Boards Users Statistics Advertise Site Info
go to bottom | |
 Message Boards » » Excel: Returning a blank cell (non-zero) Page [1]  
wdprice3
BinaryBuffonary
45908 Posts
user info
edit post

Using an if statement. If a referenced cell is blank (or zero), I want to return a blank, non-zero cell. Possible (no vb)?

I need it to be non-zero because I'm using the if function to pull a certain section of data, out of a set, and then plot that chosen data (and not having 0 values in the chart).

Ex: A1-A3 are blank/zero; A4-A10 have values

{=If(A1:A10=0,blank, non-zero,A1:A10)}

Using "", etc are picked up as zeros

12/4/2008 5:42:23 PM

A Tanzarian
drip drip boom
10994 Posts
user info
edit post

try NA()

12/4/2008 5:50:52 PM

wdprice3
BinaryBuffonary
45908 Posts
user info
edit post

hmmm... that would work for this. but it would screw up any future formulas that referenced the NA cells wouldn't it?

12/4/2008 5:53:02 PM

A Tanzarian
drip drip boom
10994 Posts
user info
edit post

Yeah, but I'm not sure there's an easy way around it.

You might end up creating two sets of data--one for formulas and one for plotting. Link them together using an if statement similar to what you have.

12/4/2008 6:05:52 PM

wdprice3
BinaryBuffonary
45908 Posts
user info
edit post

that's what I'm currently doing

shit. I'm a dumbass.

I have a sheet of data, the first column are dates, then another column has values in it, associated with that date (just numbers). If I want to pull data, per month, into separate sheets (tabs), how can I do this. My way of thinking didn't work. The data's not evenly spaced, in time (some months have more data than others).

EX:

A1:A10 are a few days in January (date format)
B1:B10 have a number in them
A11:A20 are a few days in February (date format)
B11:B20 have a number in them

and so on (but thousands of cells).

How can I pull the data from rows 1 - 10 into a sheet, and data in rows 11-20 into another sheet.

I want to do this so I can just copy the sheet and it automatically pulls the next month's informaton into a new sheet (with a few adjustments, of course).

Again, zero/non-zero cells in the master sheet must be non-zero cells in the individual sheets (NA() will suffice)

[Edited on December 4, 2008 at 6:20 PM. Reason : .]

[Edited on December 4, 2008 at 6:20 PM. Reason : .]

12/4/2008 6:06:59 PM

agentlion
All American
13936 Posts
user info
edit post

what would you use #N/A values for in other formulas?
If you need to reference those cells, you can add another IF statement inside the formula checking for #N/A, and if true, ignore the cell.
e.g.

IF(ISERROR(A1),"",do something else)

12/4/2008 6:27:32 PM

Chop
All American
6271 Posts
user info
edit post

you shouldn't have any problem using " ". (note, that's quote-space-quote). otherwise check the formatting of your cells.

12/4/2008 6:28:30 PM

wdprice3
BinaryBuffonary
45908 Posts
user info
edit post

^I meant if I were to use a formula to sum a column, it wouldn't work with NA cells. is there a way to do formulas like this, with NA cells in the range? I understand that I can use the if-statement you used, some of the time, but not with all functions.


^^ using "" or " " resulted in the chart reading those cells as zeros, not blank cells.

[Edited on December 4, 2008 at 7:07 PM. Reason : .]

12/4/2008 7:05:37 PM

agentlion
All American
13936 Posts
user info
edit post



[Edited on December 4, 2008 at 8:39 PM. Reason : .]

12/4/2008 8:39:27 PM

wdprice3
BinaryBuffonary
45908 Posts
user info
edit post

I'm thinking I need vb to be able to do everything I need to do.

Guess I'll start googling. Anyone know of good books/have one?

12/4/2008 9:09:21 PM

A Tanzarian
drip drip boom
10994 Posts
user info
edit post

Some combination of vlookup and index.

12/4/2008 9:19:45 PM

nattrngnabob
Suspended
1038 Posts
user info
edit post

Could do this in VB in about 20 lines.

12/4/2008 9:38:38 PM

nattrngnabob
Suspended
1038 Posts
user info
edit post


Dim theRows As Integer
Dim destMarker(12) As Integer

theRows = 1
While Cells(theRows, 1) > 0

destMarker(Month(Cells(theRows, 1))) = destMarker(Month(Cells(theRows, 1))) + 1
Sheets(Month(Cells(theRows, 1)) + 1).Cells(destMarker(Month(Cells(theRows, 1))), 1) = Cells(theRows, 1)
Sheets(Month(Cells(theRows, 1)) + 1).Cells(destMarker(Month(Cells(theRows, 1))), 2) = Cells(theRows, 2)
theRows = theRows + 1
Wend


This code assumes a lot.

1) The input data is on the first sheet in the book.
2) The input data starts on row 1 and is continuous. If it starts on a later row, you need to adjust theRows start value. If the data is completely continuous you'll need to do some checking of the contents and make the loop run to a fixed row or some flag.
3) January-December sheets are the next in the book in order, as long as they are in order you can apply the offset wherever January starts.

I tried this with 2 months of data and it generally works (be sure to format the column as a date at the destination sheets.

12/4/2008 10:13:33 PM

wdprice3
BinaryBuffonary
45908 Posts
user info
edit post

^thanks. I'll give it a try next week.

also, does anyone have any books/hard copies of how to learn to write vb? I can't really read a computer screen for long periods/long articles.

[Edited on December 5, 2008 at 7:15 PM. Reason : .]

12/5/2008 7:08:35 PM

 Message Boards » Tech Talk » Excel: Returning a blank cell (non-zero) Page [1]  
go to top | |
Admin Options : move topic | lock topic

© 2024 by The Wolf Web - All Rights Reserved.
The material located at this site is not endorsed, sponsored or provided by or on behalf of North Carolina State University.
Powered by CrazyWeb v2.38 - our disclaimer.