Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Pgsmom
 
Posts: n/a
Default Adding cells, using text as number

HELP! I haven't worked in Excel much, but I know there's an equation I can
use to get the information I'm wanting....
For example, I'm trying to keep tract of how many apples everyone eats. I'm
going to assign the letter "a" to Amy, "b" to Betty, "c" to Cathy, etc. Amy
eats an apple, so in cell A1, I'm going to type "a", and I want a "1" to go
to cell B6. (=COUNTIF(A1,"a")
Now here's where I'm getting myself confused....now Cathy's eaten an apple,
so I want to type a "c", and I want a "1" to go to cell B8.
(=COUNTIF(A1,"c"). But when I type the "c", it takes my "1" away from Amy.
Do I need to add something to my formula?!
Also, I need to start my count at "0". How can I do this, and keep tract of
my TOTAL amount of apples eaten?!
  #2   Report Post  
Jason Morin
 
Posts: n/a
Default

You can use a worksheet_change event. Right-click on the
worksheet tab, select "View Code", and paste the code
below in the window. Close VBE and save the workbook:

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Dim aCtr As Range
Dim cCtr As Range
Set aCtr = Range("B6")
Set cCtr = Range("B8")
If Target.Count 1 Then Exit Sub
If Not Intersect(Target, Range("A1")) Is Nothing Then
With Target
If .Value = "a" Then
aCtr.Value = aCtr.Value + 1
ElseIf .Value = "c" Then
cCtr.Value = cCtr.Value + 1
End If
End With
End If
End Sub

-----Original Message-----
HELP! I haven't worked in Excel much, but I know there's

an equation I can
use to get the information I'm wanting....
For example, I'm trying to keep tract of how many apples

everyone eats. I'm
going to assign the letter "a" to Amy, "b" to Betty, "c"

to Cathy, etc. Amy
eats an apple, so in cell A1, I'm going to type "a", and

I want a "1" to go
to cell B6. (=COUNTIF(A1,"a")
Now here's where I'm getting myself confused....now

Cathy's eaten an apple,
so I want to type a "c", and I want a "1" to go to cell

B8.
(=COUNTIF(A1,"c"). But when I type the "c", it takes

my "1" away from Amy.
Do I need to add something to my formula?!
Also, I need to start my count at "0". How can I do

this, and keep tract of
my TOTAL amount of apples eaten?!
.

  #3   Report Post  
Pgsmom
 
Posts: n/a
Default

THANK YOU!!! THANK YOU!!! THANK YOU!!!
You're infomation has been wonderfully helpful AND informative!!!

(If you get a minute, could you explain something to me?! At the end of
your code, you've got a lot of end if, end with, end if, end sub. What does
all that mean?!)

"Jason Morin" wrote:

You can use a worksheet_change event. Right-click on the
worksheet tab, select "View Code", and paste the code
below in the window. Close VBE and save the workbook:

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Dim aCtr As Range
Dim cCtr As Range
Set aCtr = Range("B6")
Set cCtr = Range("B8")
If Target.Count 1 Then Exit Sub
If Not Intersect(Target, Range("A1")) Is Nothing Then
With Target
If .Value = "a" Then
aCtr.Value = aCtr.Value + 1
ElseIf .Value = "c" Then
cCtr.Value = cCtr.Value + 1
End If
End With
End If
End Sub

-----Original Message-----
HELP! I haven't worked in Excel much, but I know there's

an equation I can
use to get the information I'm wanting....
For example, I'm trying to keep tract of how many apples

everyone eats. I'm
going to assign the letter "a" to Amy, "b" to Betty, "c"

to Cathy, etc. Amy
eats an apple, so in cell A1, I'm going to type "a", and

I want a "1" to go
to cell B6. (=COUNTIF(A1,"a")
Now here's where I'm getting myself confused....now

Cathy's eaten an apple,
so I want to type a "c", and I want a "1" to go to cell

B8.
(=COUNTIF(A1,"c"). But when I type the "c", it takes

my "1" away from Amy.
Do I need to add something to my formula?!
Also, I need to start my count at "0". How can I do

this, and keep tract of
my TOTAL amount of apples eaten?!
.


  #4   Report Post  
Myrna Larson
 
Posts: n/a
Default

Each With statement needs a corresponding End With statement. Ditto for
multi-line If statements. The reason is that you can have many statements that
are executed if the test is true, and multiple statements for the false part
as well.

On Mon, 10 Jan 2005 06:45:02 -0800, Pgsmom
wrote:

THANK YOU!!! THANK YOU!!! THANK YOU!!!
You're infomation has been wonderfully helpful AND informative!!!

(If you get a minute, could you explain something to me?! At the end of
your code, you've got a lot of end if, end with, end if, end sub. What does
all that mean?!)

"Jason Morin" wrote:

You can use a worksheet_change event. Right-click on the
worksheet tab, select "View Code", and paste the code
below in the window. Close VBE and save the workbook:

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Dim aCtr As Range
Dim cCtr As Range
Set aCtr = Range("B6")
Set cCtr = Range("B8")
If Target.Count 1 Then Exit Sub
If Not Intersect(Target, Range("A1")) Is Nothing Then
With Target
If .Value = "a" Then
aCtr.Value = aCtr.Value + 1
ElseIf .Value = "c" Then
cCtr.Value = cCtr.Value + 1
End If
End With
End If
End Sub

-----Original Message-----
HELP! I haven't worked in Excel much, but I know there's

an equation I can
use to get the information I'm wanting....
For example, I'm trying to keep tract of how many apples

everyone eats. I'm
going to assign the letter "a" to Amy, "b" to Betty, "c"

to Cathy, etc. Amy
eats an apple, so in cell A1, I'm going to type "a", and

I want a "1" to go
to cell B6. (=COUNTIF(A1,"a")
Now here's where I'm getting myself confused....now

Cathy's eaten an apple,
so I want to type a "c", and I want a "1" to go to cell

B8.
(=COUNTIF(A1,"c"). But when I type the "c", it takes

my "1" away from Amy.
Do I need to add something to my formula?!
Also, I need to start my count at "0". How can I do

this, and keep tract of
my TOTAL amount of apples eaten?!
.



  #5   Report Post  
Pgsmom
 
Posts: n/a
Default

Thank you again!!! You have been very informative!!!

"Myrna Larson" wrote:

Each With statement needs a corresponding End With statement. Ditto for
multi-line If statements. The reason is that you can have many statements that
are executed if the test is true, and multiple statements for the false part
as well.

On Mon, 10 Jan 2005 06:45:02 -0800, Pgsmom
wrote:

THANK YOU!!! THANK YOU!!! THANK YOU!!!
You're infomation has been wonderfully helpful AND informative!!!

(If you get a minute, could you explain something to me?! At the end of
your code, you've got a lot of end if, end with, end if, end sub. What does
all that mean?!)

"Jason Morin" wrote:

You can use a worksheet_change event. Right-click on the
worksheet tab, select "View Code", and paste the code
below in the window. Close VBE and save the workbook:

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Dim aCtr As Range
Dim cCtr As Range
Set aCtr = Range("B6")
Set cCtr = Range("B8")
If Target.Count 1 Then Exit Sub
If Not Intersect(Target, Range("A1")) Is Nothing Then
With Target
If .Value = "a" Then
aCtr.Value = aCtr.Value + 1
ElseIf .Value = "c" Then
cCtr.Value = cCtr.Value + 1
End If
End With
End If
End Sub

-----Original Message-----
HELP! I haven't worked in Excel much, but I know there's
an equation I can
use to get the information I'm wanting....
For example, I'm trying to keep tract of how many apples
everyone eats. I'm
going to assign the letter "a" to Amy, "b" to Betty, "c"
to Cathy, etc. Amy
eats an apple, so in cell A1, I'm going to type "a", and
I want a "1" to go
to cell B6. (=COUNTIF(A1,"a")
Now here's where I'm getting myself confused....now
Cathy's eaten an apple,
so I want to type a "c", and I want a "1" to go to cell
B8.
(=COUNTIF(A1,"c"). But when I type the "c", it takes
my "1" away from Amy.
Do I need to add something to my formula?!
Also, I need to start my count at "0". How can I do
this, and keep tract of
my TOTAL amount of apples eaten?!
.




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
To safety merge cells without data destroyed, and smart unmerge! Kevin Excel Discussion (Misc queries) 0 December 30th 04 07:17 AM
Heps to design Locked/Unlocked cells in protected worksheet Kevin Excel Discussion (Misc queries) 0 December 30th 04 07:09 AM
Convert data of cells to any type: Number, Date&Time, Text Kevin Excel Discussion (Misc queries) 0 December 30th 04 06:55 AM
Count number of shaded cells Maddoktor Excel Discussion (Misc queries) 2 December 20th 04 08:35 PM
How do I get merged cells to display all text. Excel problem Excel Discussion (Misc queries) 2 November 30th 04 04:29 AM


All times are GMT +1. The time now is 12:23 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"