I have two problems:
How to make a cell input? I need to enter a number and after pressing "enter" delete the number so I can add more input.
How to SUM the entered input with the value of another cell, for example C3 and store the result on C3?
I don't know how to delete the cell after pressing enter.
I've tried writing at C3 "=SUM(C3+F3)" and "=0+SUM(C3+F3)" both gave me a #REF ERROR.
Case:
I want to know how much money I have spent in one day. So C3 cell at the beginning have a 0 and F3 cell (input) is empty.
The point is if I buy a $3 souvenir, write 3 at F3, press enter (delete the 3 to make F3 empty) and make a SUM with whatever was at C3 plus that $3.
I would create a button, then it is clearer what you want to happen, though you could hook into the key press.
Go to File Options Customise and customise the ribbon to add the Developer tool bar.
on the Insert command, add a new button to the form. It will ask which macro you want, click New
Past this code:
Sub Button1_Click()
Range("F3").Value = Range("F3").Value + Range("C3").Value
Range("C3").Value = ""
End Sub
into the button click, and then when you click the button it will take the value in C3 and add it to F3 and then clear the value in C3.
Remember to save the workbook as MACRO ENABLE WORKBOOK, else the macros won't save.
click button
Hope that helps
Overwriting the same cell with different values and then expecting a sum of the previously entered values is not a good approach. If you want to understand why the result is a specific value, you need to be able to see which values contributed in which way to that result.
The better approach is to list all different numbers in one column and then calculate a running total in another column. Just like a bank statement. A bank statement shows you the current balance, but also each transaction, debit or credit, that went into calculating that balance. If you did not see the transactions, you don't really know if your pay check has already been included in the balance or not.
If you overwrite the same cell multiple times, how do you know if you have made a mistake and entered the cost for lunch twice, or made a typo in the numbers?
So, enter the data in rows. Each data point in a new row. Maybe use a column for date, one for money spent. Then use simple formulas in other columns to calculate what you want to calculate. You won't need any VBA or script or buttons for that.
Related
Would anyone have advise on how to add running count to excel cells, which already have text in them, and without removing the said text.
Few screenshots will follow to clarify my issue.
I have received a ton of sheets which have a test case name as a text/string in the C column and they are missing a running count from the beginning of the cell (not sure if the "running count" is the correct term).
In the first screenshot you can see how I need them to be, as well as in the couple first rows of the second screenshot (column C). So the original text could be for example "Purchase order" and I want it to be "1. Purchase order" and the next cell would be "2. Purchase order" etc.
Screenshot 1.
Screenshot 2.
I imagine there isn't an already existing function in excel which would solve my problem. I have played around with macros and VBA some years ago, but don't have any clue from on top of my head how to solve this.
Perhaps a macro that would go through each cell from the selected column one by one, cut the existing text, add a variable number to the cell and then copy the cut text back there after the variable, then add +1 to the variable before moving to the next cell?
So I somewhat understand the logic how it could be done, but don't have any memory how the syntax and the operators etc. work in VBA.
Thank you in advance.
Not exactly sure what you want from the images, but you can do things like this:
If cell A1 has 942
and cell B1 has "slices of bread"
Then C1 can have the result "942 slices of bread":
=A1&" "&B1
Not sure neither if running count is the right term, but you can do it with a helper column and an easy formula:
=COUNTIF($C$2:C2;C2)&". "&C2
Then you can copy/paste as values and delete helper column
I know this is a simple question, but, what I mean is how do you copy a cell, but when that cell changes, it doesn't affect the copy.
To make it a bit easier to understand, If I had A1 that said "Hi", and I wanted A2to say "Hi" also, I would put =A1. However, if I changed A1, it would change A2 along with it, and that is what I don't want.
I am asking this as I have a formula that says that something is so and so weeks overdue, but when a checkbox is ticked, the weeks counter stops and doesn't add any more.
Here is what I mean and the paragraph underneath states what it means and what I need from it.
The cell that says "13/02/2019" is =TODAY() and the cell that says "06/02/2019" is a date I manually entered. The problem I have is that if I came back in 1 week, it would say "Handed in late by 2 weeks." and that is what I want to prevent. However, I only want this =TODAY() to freeze when that check box is ticked.
Today() reports today's date and it will always update to the current date. Today() is a volatile function that will recalculate on every worksheet change, even cells entirely unrelated to the function. Formulas referencing a cell containing Today() will also update to reflect the current date like you are experiencing now.
You appear to be looking for a process that will snapshot the date at the time of an action (checking a box). If you want it to be a formula, you will need to input the date of return as well and create a formula comparing the difference between to two inputs. There is already a shortcut to insert today's date in a non-formula method: Select the cell and press Control + ; (semi-colon). A simple formula that references the difference between the check-out and check-in dates on a per line basis with rounding and concatenate functions, should accomplish the described purpose.
A1 = (Checkout date)
B1 = (Return Date)
C1 =IF(ROUNDUP((B1-A1)/7,0)=1,CONCATENATE(ROUNDUP((B1-A1)/7,0)," Week"),CONCATENATE(ROUNDUP((B1-A1)/7,0)," Weeks"))
This function checks the difference between A and B, divides by 7 to get number of weeks, rounds it up to a whole number, and checks if the number of weeks is 1 or not. If it is one the text will say " week" otherwise it will say " weeks". This also avoids using a volatile function which in larger projects would cause incessant and potentially resource demanding calculating.
In Excel I have a list of employees (see image) and I want to store their salary update history. For each salary update, I want to calculate the difference in their total salary. I'm unable to create a formula to calculate this and SUM() the updates per period for me.
The image below demonstrates my spreadsheet and the desired salary update total (I did calculations manually, bet need a formula for this). In reality, there will be a few dozens of employees, so the requirement for the formula is to be dynamic and not contain manual "+" for each row.
NOTE: For some people their salary can stay unchanged and there are not any values in some cells. It's the main challenge, since we have to find the value of the "previous salary" for an employee, because it's not necessary stored in the previous cell. Otherwise, I could have used a simple array formula, like:
{=SUM(G3:G6-H3:H6)}. But unfortunately, it does not work in this case (there can be no value in the H column, so we have to find where it actually is).
Also, the formula should work correctly with filtering: is some row is filtered out (person is inactive, see picture), this row/cell should be ignored.
Can anybody help me with this formula that I'm struggling with?
This will do what you ask, not my my best work.Column "I"is still =SUM. Remember to press Ctrl + shift + enter. Then drag the formula where you want it to apply.
{=IFERROR(IF(E3="",E3,E3-INDEX(F3:$I$3,MATCH(FALSE,ISBLANK(F3:$I$3),0)))
+IF(E4="",E4,E4-INDEX(F4:$I$4,MATCH(FALSE,ISBLANK(F4:$I$4),0)))
+IF(E5="",E5,E5-INDEX(F5:$I$5,MATCH(FALSE,ISBLANK(F5:$I$5),0)))
+IF(E6="",E6,E6-INDEX(F6:$I$6,MATCH(FALSE,ISBLANK(F6:$I$6),0)));SUM(E3:E6))}
This formula does give the same answers as yours on the test data as below, BUT it is making a very big assumption - that the last recorded salary is always the largest one.
=SUM(IF(D3:D6="",0,D3:D6-SUBTOTAL(4,OFFSET(E3,ROW(D3:D6)-ROW(D3),0,1,COLUMNS(E3:$J3)))))
Must be entered as an array formula using CtrlShiftEnter
If you want to ignore hidden rows, plz use the form of Subtotal that ignores hidden cells
=SUM(IF(D3:D6="",0,SUBTOTAL(104,OFFSET(D3,ROW(D3:D6)-ROW(D3),0,1,1))-SUBTOTAL(104,OFFSET(E3,ROW(D3:D6)-ROW(D3),0,1,COLUMNS(E3:$J3)))))
Help Main Sheet
First Data
Main Data Label
Why Hello!
I am having a hard time completing an in-depth if function. Here is my issue:
I have a list in Column A with drop down buttons. Out of those 60 items, I need 5 of them to have a running total IF they are selected. Currently my function looks like this but obviously isn't working if I am asking here. It will not keep a running total in the same cell if any combination are chosen. IE if 1 is chosen cell value = 4. If 2 are chosen cell value = 8
=IF(OR(COUNTIF(Testing!C12:E27,CharacterSkills!B4),COUNTIF(Testing!C12:E27,CharacterSkills!B6),COUNTIF(Testing!C12:E27,CharacterSkills!B16),COUNTIF(Testing!C12:E27,CharacterSkills!B25),COUNTIF(Testing!C12:E27,CharacterSkills!B28),COUNTIF(Testing!C12:E27,CharacterSkills!B31)),A18+4,0)
Specifics:
MainSheet: Cell C12:E27 are drop downs pulling from "Data Table" Photo (The selection is filtered by Cell E6 (Class). Using Data Validation =OFFSET(CharacterSkills!$A$1,MATCH($E$5,CharacterSkills!$A:$A,0)-1,1,COUNTIF(CharacterSkills!$A:$A,$E$5),1)
First Data: Cell B18 is the cell I would like to keep a running total in. For example, everytime Arcane Magic, or Divine Magic is selected I would like it to add 4 to that cell each time
Data Table: This is the main data table for the drop downs on the MainSheet.
Thanks for all your help!
In cell B18 on the sheet "First Data", input the formula below. This will work for the test case given. If you want this to be more dynamic (ie input all the things that necessitate a +4 in a range and just reference that) you will need a more complex formula. I am happy to help with that as well, but thought I would give you this, which fits the criteria above.
=(Countifs(Testing!C12:E27,"Arcane Magic") + Countifs(Testing!C12:E27,"Divine Magic"))*4
More complicated answer:
Let's say instead of stringing together Countifs() statement, you had a range Testing!XFD1:XFD2 and in XFD1 you have Arcane Magic and in XFD2 you have Divine Magic. If this were the case, you could instead use:
{=SUM(COUNTIFS(Testing!C12:E27,Testing!XFD1:XFD2))*4}
Note this must be entered using Shift + Ctrl + Enter. The curly braces will be input when you enter the formula, you do not enter those on your own.
VBA can turn over Excel anyway you want .SO pl understand this question is NOT the duplicate of a similar question that asks how to get it done using VBA.
I would like to assign the current date to a cell and PRESERVE that value
That means after opening the file a few days , on the value should NOT change How do I get this done using a NON VBA formula based approach
a1=Date()
but the date value does not change.
Thank you both. You both rock. But stack will not let you do > 1
Both answers are practicable but given the reqs, I had - I just wanted to
'dirty stick in' the date wherever I want without scratching around .
The 1st answer is useful if you have a conditional logic 1 col
update should get a date in ,the other column. The 2nd one does the
quick stick of the date.
I don't see the problem. If you want a static date in a cell, just click on the cell and enter something like:
2/11/2016
The date will not change unless you change it.
If you are not certain of the current date, then click on the cell and touch:
Ctrl + ;
Like said many times at this side:
Goto options -> formulas -> enable iterative calculation
Then in A1:
=IF(A2="","",IF(A1="",NOW(),A1))
If you put anything in A2 then A1 will become the actual date/time and stay with this value as long as A2 is not empty... it will not change in later calculations ;)
You can try this with the actual formula (showing also time including seconds) it will not change. If you empty out A2 and reinsert something, it will jump to the new time and then stay with that value as long as you want (even close/open will not change that)