Excel apply a formula to same cell - excel

It could be a basic one, trying to apply formula =TEXT(A2/(24*60*60),"dd \d\a\y\s hh:mm:ss") on the same column Seconds to a new computed value. For eg., 495079 tranform to 05 days 17:31:19. I don't want to bring in additional columns. Any help is appreciated.

Duplicate: this answer.
#MADHU VS - your formula is exactly like the one in that answer. Maybe what's confusing you is you think the answer should be 5 days - it's really 4. "04 days 17:31:19"
The person who answered on the other thread also made a useful suggestion not to use the text function. Use =A2/(24*60*60) on your sheet, then go into the time formatting dialog and set up a custom format dd \d\a\y\s hh:mm:ss.
I just tried that, and it works perfectly. I was able to subtract 1 from it in a different cell, and got "03 days 17:31:19" (if that would be useful to you).

24*60*60 = 86400.
Enter =86400 in a cell. Copy that cell. Just select the range of the "Second" numbers only (not the entire column) and right click then select Copy paste special, select divide (Also select values if so desired), click OK. No need for another column.
Then format cells pressing Control + 1

Related

How to add running count to excel cell, which already has text in it?

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

Excel formula for every 2 weeks

On my planner I have a section with recurring dates (see pic below) that I use to copy/paste cells into the main body of my planner as needed.
I use the formula below (Thursday shown) for 'recurring every week', but what about 'recurring every 2 weeks'? I'll need to use the DATE() function I think, copy/paste and then edit the date in the formula each time, I'm OK with that, but struggling to come up with the right formula.
=IF(WEEKDAY(TODAY())=5,TODAY(),TODAY()-WEEKDAY(TODAY())+5 + IF(WEEKDAY(TODAY())>=5,7))
In order to create a 2-week switch, I'd go for a weeknumber mod 2:
=MOD(WEEKNUM(TODAY(),11),2)
This gives 1 for odd, and 0 for even week numbers.
Good luck

MS excel : Freeze the current date value using a NON VBA approach

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)

Excel always change my data to date when copy a html sheet to it

I copy a sheet from html page.Because I need the sheet structure,the "paste as text" selection is no use here.
The data will be like this
2/3 3/4
1012/2332 332/665
when paste to excel
2/3/2012 3/4/2012
1012/2332 332/665
the data cannot be parsed to date form is safe while those which can will be changed and cannot be changed back in format cell.
How to disable this feature of excel,really annoying.
This is an obnoxious problem. Have you tried setting the cell format to Text before pasting as text? this works for me in 2003. I'm afraid simply doing one or the other is not enough, and the order is important.
If this works (and you need to do this frequently or regularly), you can set up a custom macro (e.g. CTRL-SHIFT-P, etc.) to set the format and do the paste all in one motion.
EDIT:
For the record, here is what the different paste methods produced for "2/3":
Paste (normal) 3-Feb
TXT Format->Paste 3-Feb
Paste->TXT Format 40942
Paste UNI 3-Feb
*TXT Format->Paste UNI 2/3
Paste UNI->TXT Format 40942
Paste TXT 3-Feb
*TXT Format->Paste TXT 2/3
Paste TXT->TXT Formar 40942
Up until recently (2/27/2013) the Excel data import of the bank account text file information handled the date field of the text file correctly. It isn't clear to me why this changed, but it lead to my looking here for a solution.
I'd like to propose to you a different solution than above...
copy the offending dates to a separate excel sheet
use the Mid function ( mid(string, start, number of chars) to extract each date component to
a separate column in the same row (Look at columns B, C, and D
in the next column use the Date function ( date(yr, month, day) to convert the date components
from the prior three columns into something excel will deign to recognize as a date (remember,
computers are basically stupid, and Microsoft programs are about the contrariest things on the
planet!)
PASTE SPECIAL the values from your date column back to your worksheet
VOILA! You have fixed a problem that you should NEVER have had in the first place.
I tried to paste the spreadsheet here (and also by hand typing, but this display collapses repeating characters. Suffice to say it looks like this...
02/27/2013 02 27 2013 02/27/2013
original mm dd yyyy value ms recognizes as a date which you can paste by value back to spreadsheet
the formulas for those not familiar with Excel...
un-date from worksheet in column at (excel sees as a string...not a number!)
for month: mid(a1,1,2) (take the thing in column a1, start at the 1st character, and grab two chars)
for day: mid(a1,4, 2) (take the same thing from column a1, grab the two chars starting at the 4th)
for year: mid(a1,7,4) ...
making it a date: you now have month in column b1, day in column c1, and year in column d1, so
in column e1 you say: date(d1, b1, c1), and then you see the same date as shown in column a1, however, this will now be recognized by Excel as a date! Copy this and PASTE SPECIAL>Value to the column in your original worksheet and it will respond.
I had looked in the original column for a ' character which denotes treat this value as text only, but I hadn't found one. I do not know why Excel has become pesky like this, but I have come to expect this type of frustrating and annoying behavior from Microsoft programs. Yes, I do still buy the darn things, but often choose open source code when I can because of these "features".
Good luck.
I just came across this problem and found a really good solution. Here are my steps:
Copy and paste so that you can work out the area to be selected.
Delete the contents of the cells
Change the formatting to TEXT
re-paste but use the paste button in the menu bar and choose 'Match Destination formatting'.
This works like a dream! :)

Excel: Leading Zeros on Dates.. Formula to do it for me?

Is there a way to add a leading zero to a date that is 7 digits and should be 8?
7301982 should be 07301982.
I have a column full of these values, and need a way to do so with a formula. Any ideas?
I know this is an oldie, but when I googled for a solution this was the first result.
What I did was:
=concatenate(year(A1),text(month(A1),"00"),text(day(A1),"00"))
Where A1 is a date field.
=text(A1, "00000000") will do it.
Set a custom format of 00000000
Just another thought since this just happened on my new laptop. It could be your windows settings. If you prefer leading zeroes on the month everywhere in windows (like the lower right hand clock) then you can:
Control Panel >> Clock, etc >> Change Date, Time or Number Formats... then set the Short Date to MM/dd/yyyy.
This also carries over to Excel as the first date format. I know it is not a formula exactly as asked, but this is the article I found while searching.
Simply go to custom for the format of the number and select yyyy\m\d and add more m or d to it.
This is a good formula when you need leading zeros so another application sees a 9 digit number.
Add a column to your spreadsheet (Column B if your data is in Column A)
Use this formula in the new column: =REPT(0,9-LEN(A2))&A2&""
Get the 1st cell, then drag down as much as you need.
Remember to copy/paste option 123 to save as data. Otherwise, you'll see data but in reality it is a formula and you will receive reference errors if you try to use the data in column B.
9 digits and column B are variables. You can use any length or any column on your spreadsheet. Just adjust the formula.
Copied from another answer on a different site, worked for my like a charm!
ok. It seems that your dates are formatted as text. This is what you should do.
first, on a blank cell somewhere on the sheet, type the number 1. then, right click, copy.
next, highlight the entire column of dates. right click, paste special, multiply.
all of the dates will have turned into numbers.
next, highlight the date column, and apply the date format that you want.
There is a simple way to maintain the leading zeroes in Excel.
Simply add this to the cell and type whatever value you need and the zeroes will be retained
For ex: If I want 0000000023
Type into a cell '0000000023
That ' symbol seems to retain the zeroes as long as you type it before the values.
This date format MM/DD/YYYY is available if you select the Locale (location): English (Philippines). Try it with one cell and then copy/paste/special/formats the others.

Resources