Just a simple question...

chazrab

Well-known Member
Joined
Oct 21, 2006
Messages
918
Office Version
  1. 365
Platform
  1. Windows
...can you put a "ghost"number in a cell and not have it counted when adding values in a column that includes that cell? When vb code for Textbox1 on a form executes for that cell, the "ghost" number will be replaced by the value of Textbox1. The "ghost" number can be any number - it's just a reminder number for users to reference when entering a value for Textbox1.

Any help on this out there? - this should be very easy - just can't think of how to do this.
PS I know what comments are. Don't want that. I want to "see" a number - visible to users, but not visible to Excel, maybe would another explanation.

Thanks for anyone's help.

CR
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
if i get you right, you have a text box that is going to have a default value in it, just to remind the user to make an entry? two options i can think of:

have the value that the user enters passed to the .tag property of the textbox then insert that value into the spreadsheet.

or just test if the textbox is blank before it's value is inserted, if it is blank, get the user to enter a value before the code continues.

would offer more help but my lunch break is almost over :D
 
Upvote 0
no - Textbox1 values come later and there is no default in the textbox. The ghost value is already in the cell. The form I mentioned is just a vehicle for users to enter values - any values they want in the cell containing a ghost value. The ghost value is replaced by the textbox value when the code for the textbox executes. Below:

Cell A1 starts out with a blank value. A user manually enters 1 in cell A1. Here's what I need to have happen:

In Cell A1 a ghost value = 1
In Cell A2 a normal value = 2
In Cell A3 a normal value = 3
=Sum(a1:a3) = 5, which is what I want - not 6, yet 1 still appears in A1.

Again, by "ghost" I just mean it's visible to users but not "visible" or "recognized", or "counted" in the =SUM formula by Excel. It's a dummy value to use as a reminder.

Now, a form with Texbox1 and an OK button pops up on the screen prompting a user to enter a value in a Textbox1 The user enters a value in Textbox1 of say, 60 and presses the OK button. When that happens, the vb code puts the value of 60 in cell A1. The value in A1 is now 60 and the ghost number 1 is replaced. Then

=Sum(a1:a3) = 65

Note: the ghost value can only be entered ONE time and only in a blank cell. The replacement value from the code is the permanent real value counted in the SUM formula.
This is a projected future BUDGET spreadsheet. Ghost values will be entered and subsequently replaced by real values at times in the future which have not occured yet.

Please help if you can.

CR

That is as simple as I can make it.
 
Upvote 0
How about making your original formula be:
Code:
=Sum(a2:a3)
Then, in the code for TextBox1, when you have it input it's value to A1 have it simply amend the formula at the same time to be =Sum(a1:a3)

That sound like it would work?
 
Upvote 0
Alternatively, if the ghost values are entered with a single quote as a prefix, excel forces the number to be text and would be excluded in the sum.

Later when the Textbox1 updates the ghost value with an actual value (as a number), that will be included in the sum. Hope this helps.
 
Upvote 0

Forum statistics

Threads
1,224,595
Messages
6,179,799
Members
452,943
Latest member
Newbie4296

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top