Excel Conditional Adding
Comprox
*chortle*Canada Join Date: 2002-01-23 Member: 7Members, Super Administrators, Forum Admins, NS1 Playtester, NS2 Developer, Constellation, NS2 Playtester, Reinforced - Shadow, WC 2013 - Silver, Subnautica Developer, Subnautica Playtester, Pistachionauts
![Comprox](https://forumsdata.unknownworlds.com/uploads/userpics/718/nYEQEK6LNWG9J.gif)
Question time:
In excel, I am trying to do some addition (no, can't use anything else, at work). I would like it to go through column B (the A1, B1, etc), find all the A1's, and add the total of the number to the left of them (another column). It needs to be dynamic since the real excel file is massive and updated daily. Thoughts?
In excel, I am trying to do some addition (no, can't use anything else, at work). I would like it to go through column B (the A1, B1, etc), find all the A1's, and add the total of the number to the left of them (another column). It needs to be dynamic since the real excel file is massive and updated daily. Thoughts?
Comments
Just press F1 for the excel help and search for "boolean" the functions you are searching for should pop up. Its prolly named "IF".
Arg, damn stupid forum limits.
Drop me a line if you need an example file.
OK, code from the german version:
<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->=WENN(B2="A5";A2;0)<!--c2--></div><!--ec2-->
What this does, is check if b2 does contain the string A5 (hence the ""). If it does then it displays the contents of A2, otherwise it displays 0. Now all you need to do is copy that down and then add a sum at the end.
And again the english version uses most likely IF instead of WENN.
Edit: And if you need to copy cells from left to right use "ctrl+r". You can also tell the formula to NOT adjust for line and column by adding a "$" in front of the cell-indicators.
So "=$A$3" will always point to A3 when copied.
"=$A3" will only adjust for the line
"=A$3" will only adjust for the column
Mark a few cells
right click them
select format cells
there select the numbers tab
under category mark "user defined"
write <!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->;;;<!--c2--></div><!--ec2--> where it says type
this will hide a cells content
(for the example file you gave)
<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->Sub Macro1()
Cells(2, 2).Select
Do While ActiveCell <> ""
If ActiveCell.Value = "A1" Then
Range("E3") = Range("E3") + Cells(ActiveCell.Row, ActiveCell.Column - 1)
ElseIf ActiveCell.Value = "B1" Then
Range("E4") = Range("E4") + Cells(ActiveCell.Row, ActiveCell.Column - 1)
ElseIf ActiveCell.Value = "B2" Then
Range("E5") = Range("E5") + Cells(ActiveCell.Row, ActiveCell.Column - 1)
ElseIf ActiveCell.Value = "C3" Then
Range("E6") = Range("E6") + Cells(ActiveCell.Row, ActiveCell.Column - 1)
End If
ActiveCell.Offset(1, 0).Select
Loop
End Sub<!--c2--></div><!--ec2-->
but really, you're better off doing it the old fashioned way since the macro would have to be run each time for the values to be updated.
As an alternative to what Faskalia said, to hide cells, you can also just change the font color to white like me <img src="style_emoticons/<#EMO_DIR#>/tounge.gif" style="vertical-align:middle" emoid=":p" border="0" alt="tounge.gif" />
As an alternative to what Faskalia said, to hide cells, you can also just change the font color to white like me <img src="style_emoticons/<#EMO_DIR#>/tounge.gif" style="vertical-align:middle" emoid=":p" border="0" alt="tounge.gif" />
<!--QuoteEnd--></div><!--QuoteEEnd-->
See, thats the reason you are the "Jester of Excel" and I am the "King of Excel". <img src="style_emoticons/<#EMO_DIR#>/tounge.gif" style="vertical-align:middle" emoid=":p" border="0" alt="tounge.gif" />
.
.
.
.
Cheapo... CHanging the font colour to match the background. Thats sooooooo dodgy
But you said you figured it out already so maybe this is what you figured out, so grats <img src="style_emoticons/<#EMO_DIR#>/biggrin-fix.gif" style="vertical-align:middle" emoid=":D" border="0" alt="biggrin-fix.gif" />