sum by coding without 0 #2

hi

in the following program if there is no value in the cells a1 and b1
it returns 0

 Public Sub Add2Cells()
      Range("C1").Value = Range("A1").Value + Range("B1").Value
   End Sub
i need only the output if the both the cells have the data will you
can tell me that
0
kaja48380 (18)
3/1/2008 10:51:55 AM
excel.newusers 15348 articles. 2 followers. Follow

2 Replies
715 Views

Similar Articles

[PageSpeed] 47

Public Sub Add2Cells()
    If Range("A1").Value <> "" And .Range("B1").Value <> "" Then
         Range("C1").Value = Range("A1").Value + Range("B1").Value
    End If
End Sub


-- 
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"kaja" <kaja48380@gmail.com> wrote in message 
news:bd34f62a-5f34-48c3-8b6a-122a9decc627@e25g2000prg.googlegroups.com...
> hi
>
> in the following program if there is no value in the cells a1 and b1
> it returns 0
>
> Public Sub Add2Cells()
>      Range("C1").Value = Range("A1").Value + Range("B1").Value
>   End Sub
> i need only the output if the both the cells have the data will you
> can tell me that 


0
bob.NGs1 (1661)
3/1/2008 3:34:47 PM
I think you included an extra period
..Range("B1").Value <> "" 
probably s/b
Range("B1").Value <> "" 



"Bob Phillips" wrote:

> Public Sub Add2Cells()
>     If Range("A1").Value <> "" And .Range("B1").Value <> "" Then
>          Range("C1").Value = Range("A1").Value + Range("B1").Value
>     End If
> End Sub
> 
> 
> -- 
> HTH
> 
> Bob
> 
> (there's no email, no snail mail, but somewhere should be gmail in my addy)
> 
> "kaja" <kaja48380@gmail.com> wrote in message 
> news:bd34f62a-5f34-48c3-8b6a-122a9decc627@e25g2000prg.googlegroups.com...
> > hi
> >
> > in the following program if there is no value in the cells a1 and b1
> > it returns 0
> >
> > Public Sub Add2Cells()
> >      Range("C1").Value = Range("A1").Value + Range("B1").Value
> >   End Sub
> > i need only the output if the both the cells have the data will you
> > can tell me that 
> 
> 
> 
0
jmb (270)
3/1/2008 3:52:03 PM
Reply:

Similar Artilces:

Sync my outlook 2007 main calendar with a shared calendar on WSS 3.0
Does anyone know of a way that allow you to sync your main outlook 2007 calendar with a shared WSS 3.0 calendar? I've just setup my Windows HomeServer and install WSS 3.0 on it to run as a family extranet where my family can share information with each other while on the move. And one of things I am currently trying to do is have a single family calendar the family that everyone can sync their calendars to so we can all see what each other are doing. I've managed to get Outlook to sync with a calendar on WSS 3.0 in a 2 way fashion however if you want the family to see when you ...

Corrupted pst files #2
Hi, My outlook 2003 file is corrupted, it says when i try to open it "unable to open because it's not a personal file folders" I ran scanpst.exe, it detected an error and said that the file is repaired. but still i cannot open it. i downloaded a tool Outlook Recovery, it works but it's a demo version. Does anyone knows a free tool that allow me to recover my Emails, Please it's urgent... WaJo <wajoum@gmail.com> wrote in message news:1140273099.291551.97380@g14g2000cwa.googlegroups.com... > Hi, > > My outlook 2003 file is corrupted, it says wh...

VB Code for Naming Ranges
Can somehere tell me how to name a range in excel using VB code. Here' how I get the range: Range("L1").Select Range(Selection, Selection.End(xlDown)).Select Range(Selection, Selection.End(xlToRight)).Select Selection.Copy Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone SkipBlanks _ :=False, Transpose:=False Application.CutCopyMode = False As u can see the range changes, but I would like to create the sam name for whatever the range is? Thanks. -- Message posted from http://www.ExcelForum.com the code you can use is ActiveWorkbook.Names.Add Name:="YO...

CRM 4.0 Install Error: The underlying connection was closed
Please help.... Running setup again of CRM 4.0 because my new product key needed to be upgraded from the trial... I backed up the database and did everything according to knoweldge base article 947272 - http://support.microsoft.com/kb/947272 But when installing (step 6 of above KB), after the part about the email router, when it validates the setup environment, the report server generates an error that the underlying connection was closed and installation cannot continue... Exact error message is: Setup failed to validate specified Reporting Services Report Server http://server/repor...

Calendars #2
Schedule of Events is visible but not avtive on a Calendar. How do you make of use of a schedule and activate it in a Calendar. ...

How to get #value! to return a value of 0?
My formula is like this: =A2+B2+C2. However, some of the values in the B2 column are "--," indicating "not applicable". When I use the formula, it interprets this as text, of course, and returns the error value of #VALUE! I want it to treat these as zeroes. How can I do this? I tried doing a FIND AND REPLACE, but it did not recognize any of the "-- " values in the FIND. Can anybody help? =SUM(A2:C2) would be the easiest way. SUM will ignore text. tj "rhodesv" wrote: > My formula is like this: =A2+B2+C2. However, some of the values i...

How to perform sum sum sum...
How to perform sumation within that particular item but the item is not unique...means item 1 has its own quantity and same goes to item 2...but in the same table... -- Message posted via http://www.accessmonster.com On Tue, 17 Apr 2007 05:28:12 GMT, "EMILYTAN via AccessMonster.com" <u33296@uwe> wrote: >How to perform sumation within that particular item but the item is not >unique...means item 1 has its own quantity and same goes to item 2...but in >the same table... Group By the item. For a more detailed answer, please post a more detailed question (with a des...

Converting a number to 2 decimal places
I would like to be able to type a number into a cell and have i automatically converted to a number with the last 2 numbers to th right of the decimal point. For example, if I typed in 1234, it woul become 12.34. How can I do that -- mattsla ----------------------------------------------------------------------- mattslav's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=2403 View this thread: http://www.excelforum.com/showthread.php?threadid=37648 Tools>Options>Edit Check Fixed decimal places Set for 2 Does that help? Ron -- Ron Coderre -------------...

What code would I use for this?
Let's say I have a bunch of Item Numbers in Col A. In Col B are quantities we have in stock. Is there some code I can use to total up each item group? For example let's say I have the following: col a | col b 1282-3622 | 10 1282-3611 | 12 1282-3582 | -5 9601-9000 | 8 9601-3672 | 14 ... when the code runs it would turn into this automatically col a | col b 1282-3622 | 10 1282-3611 | 12 1282-3582 | -5 17 9601-9000 | 8 9601-3672 | 14 22 ... it totalled up all the 1282's together, and all the 9601's together. Most of our item number a...

Not Auto-forwarding Spam Filtered by SpamBayes #2
I'm using SpamBayes on Outlook 2000 for Exchange Server. I have set an auto-forwarding rule. Currently this rule forwards all the messages including Certain Spam and Possible Spam messages as identified by SpamBayes to another e-mail address. I would, however, like to modify this rule such that Certain Spam will not be forwarded. Is there a way? ...

What Outlook capabilities without Exchange Server?
Do anybody know, what capabilities remains in Outlook if use outlook 2003 in organization without Exchange server? Only use Outlook smtp mailboxes with external mail server provider. I know, that will be no Public Folders, no ability to see calendars of other colleges. And what else? Can I do Meeting Request, Task Request and so on? ...

Multiple variables to sort and sum, return values<0 with sum refer
Can anyone help me with this one please? I have this table of data. I'd like to be able to write a formula(s) which sums the No according to date and code, but then only returns a sum value (with the code and date in the two adjacent cells) if there is a value greater than 0. Code Ref No Date 1 G/032/05/999 400600 212 19/03/2010 2 G/032/03/001/999 400500 50 19/03/2010 3 G/032/02/001/001 400400 170 19/03/2010 4 G/032/05/999 400600 315 19/03/2010 5 G/032/03/001/999 400500 300 19/03/2010 6 G/032/05/999 400600 202 19/03/2010 7 G/032/03/001/002 40...

Field with Bar Codes beginning with 0
Have an inventory spreadsheet with a colum called barcodes Some barcodes begin with the numberic value 0 ( Zero ) we could have 50060192754 00075325498 however, the barcode begining with 0 gets truncated to 75325498 The problem is compounded as the worksheet is linked to access where the values are all wrong also. any ideas ?? Pat Coleman wrote: > Have an inventory spreadsheet with a colum called barcodes > > Some barcodes begin with the numberic value 0 ( Zero ) > > we could have > > 50060192754 > 00075325498 > > however, the barcode begining with ...

Uanble to synchronise Appointment With CRM 4.0 #2
Hi, When i am trying to create a appointment in Outlook and then i click on the "Track In CRM" button,I get an error message saying me that "The logged in user does not have appropriatre security permissions to view these records or perform the sprcific action" Can anybody please give me a solution to this? In the Security roles , i have clicked on "Synchronise with Outlook" Please reply soon.:) ...

how to find out code
Hello, My MFC app crashed in module msvcrt.dll at 001b:77c37098. What can I do to find out what is on that address? Thank you Vaclav > My MFC app crashed in module msvcrt.dll at 001b:77c37098. What can I do to > find out what is on that address? > Its likely because something wrong was passed to it which caused it. Typically when you debug you will be able to pinpoint the cause as you will have the stack to see what parameters you are passing etc. Debug the app and see if you can reproduce it. --- Ajay It happened on the customer's PC. The app generated a crash dump and...

POS 2.0 to RMS 2.0 migration
Are there any tools out there (upgrade programs, SQL Scripts, KnowledgeBase articles) whch will allow a POS 2.0 system (not POS2009) to be migrated to RMS 2.0? Can't go into the details, but we have someone who is currently running POS 2.0 at three separate locations and may want to move to RMS and bring these disparate locations under the Headquarters umbrella. -- Bill Yater Blue Horseshoe Solutions byater@bhsolutions.com None that I have seen, Best option export everything to a CSV, and say goodbye to sales history. I am sure there is someone that could move all the info for y...

Log-log charts #2
Hi, I'm using Excel 2002 and am trying to create a simple log-log plot. Making the y-axis logarithmic is easy - it's a check-box option under Scale tab of the Format Axis dialog. But for the X axis the dialog does not have that option. My XY data is valid (all positive values). There's web sites that say you can do this (e.g. http://cstl-cst.semo.edu/venezian/Utilities/graphs.htm). Why doesn't my Excel support it??? Any help is appreciated. Walt Hi Walt, Sounds like your chart maybe a line chart (x-axis is category) instead of true xy scatter. Right click the chart...

Summing up user defined results
Hi all - I'm new to VBA programming in Excel and so any help i'd totally love! I'm currently writing a function. Objective: user can select rows (do not have to be sequential). User clicks on button. UserForm appears with summed results from ONLY rows that he selected. What I have now, well it doesn't work: Sub Button6_Click() Dim i As Integer Dim totalNumbers As Integer Dim aRange As range For Each a In Selection.Areas 'MsgBox "Area " & i & " of the selection contains " & _ ' a.Rows.Count & " rows." &...

sum subform to form
=Sum([Forms]![frmCamPledgeList].[frmCamPledgeListSub].[Amount Pledged]) Form (frmCamPledgeList) with subform frmCamPledgeListSub). Subform has a field named Pledge Amount. I want to put a field on the form that gives me a total of the subform's Amount Pledged. I have tried the above, but I get an #error in the unbound text box. Do you need any more info? Any thoughts on why this does not work? Thanks in advance, Scott -- Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/Forums.aspx/access-forms/200912/1 The proper syntax is =Sum([Forms]![frmCa...

pasting or moving formula cells without updating formulas
I have a flat spreadsheet with a results page at the end. The results page contains a set of formulae which refer to various cell locations within the body of the spreadsheet in order to return statistical results based on the values in said cells. Now I'd like to add more data to my spreadsheet, so i need to make it bigger; however, when I copy and paste, or select and drag the cells containing the formulae, Excel updates the formulae so that they refer to different cells which bear the same spatial relationship to the formulae as the original referees did before the formulae were ...

Help with combining 2 seperate Worksheet Change Event scripts
Hi, I have 2 seperate Worksheet Change Event scripts that I would like to combine to use in one woeksheet and I'm sure how to do. I am kind of new to VB. The first script is for hiding columns based on a value selected in picklist. Private Sub Worksheet_Change(ByVal Target As Range) 'SalesAid Software If Target.Address <> Range("L2").Address Then Exit Sub 'MsgBox Month(Target) If Target = "All" Then Range("N:BV").EntireColumn.Hidden = False Else lastcol = Cells(6, Columns.Count).End(xlToLe...

Some VB code
hi, i'm having trouble creating some vb code to do the following, since i'm not that familiar with sql. how would i do the following, in visual basic code to run from a macro, or a button press? must do following, during the process of importing to the table. put 10% of recordset size in an integer (concatenate as necessary) exclude all records that contain the text "mile" "mlg" or any other abbreviation for "mileage" in the .[report name] field Tableappend gets all records that: for orgs 010, 528, 113, 185 where ..postedamount > $1500.00 tableapp...

PST issue #2
Hello, I have inherrited a problem that's got me confused. A user had a large PST file that was never backed up. Wanted it copied to their server for safe keeping in prep. of having a new PST created to work from. Original size was 3.6GB. Moved the file to the server share (full access rights) Opened outlook and the file is there, no problems, but now it's only 1.6GB in size. Here's the strange part: Data and e-mails from 2004-2006 is there. No data from 9/2006 until 1/2007. Any ideas on how to recover this? Is the data gone? I have already tried to pick through the hard driv...

Office:mac disk ejects without loading??
Has anyone else had this problem with Office:mac? Trying it on a new macbook pro (intel). This is the only CD that won't run. There are no surface marks or defects. Any ideas? Hi Claude - Just because *you* can't see the flaws of a CD/DVD doesn't meant the 'eye' of an optical drive can't, so I wouldn't rule out a defective disk just yet. The defect doesn't have to be physical - it can happen during the recording process if the disk isn't written to correctly. Can you test the disc on another Mac? Are there any error messages? If so, what do they say?...

Can I do this? #2
The formula I am using is =I17-40. What I want is for the cell to show a zero if the result of the formula is less than zero. In other words, show a zero if the result of the formula is in the negative. Can I do this. Please e-mail Lee at lee.davenport@nashcountync.gov if you can help. Thanks. =if(I17-40>0,I17-40,0) "Lee and Rebecca" wrote: > The formula I am using is =I17-40. > What I want is for the cell to show a zero if the result of the formula is > less than zero. In other words, show a zero if the result of the formula is > in the negative. Can I do this...