Previous in Forum: Sump Pit or Rain Catcher   Next in Forum: DNA Based Computing
Close
Close
Close
14 comments
Rate Comments: Nested
Active Contributor

Join Date: Jan 2010
Location: Ahmedabad
Posts: 17

Excel Formulaes

02/22/2011 6:44 AM

Hi to all,

i want to enter text "p" in all the colums which are left blank.

what i mean to say is that suppose if i am entering value 1 in all cell of column (A1, A2, A3 ...) and left the cell A5 and continued with A6,A7 and so on the cell A5 should automatically write "p" in place of blank.

hope you are getting my question and sorry for my bad english

__________________
A Good Experience Comes From Bad Judgment But, Good Judgment Comes From Bad Experience
Register to Reply
Interested in this topic? By joining CR4 you can "subscribe" to
this discussion and receive notification when new comments are added.

Good Answers:

These comments received enough positive votes to make them "good answers".

"Almost" Good Answers:

Check out these comments that don't yet have enough votes to be "official" good answers and, if you agree with them, vote them!
Guru
United Kingdom - Member - Indeterminate Engineering Fields - Control Engineering - New Member

Join Date: Jan 2007
Location: In the bothy, 7 chains down the line from Dodman's Lane level crossing, in the nation formerly known as Great Britain. Kettle's on.
Posts: 32175
Good Answers: 839
#1

Re: Excel Formulaes

02/22/2011 8:16 AM

Try this.

Enter:

=if(A1="", "p", A1)

into cell B1, replicate the formula down the screen as far as is needed, hide column A and use column B instead.

__________________
"Did you get my e-mail?" - "The biggest problem in communication is the illusion that it has taken place" - George Bernard Shaw, 1856
Register to Reply
Active Contributor

Join Date: Jan 2010
Location: Ahmedabad
Posts: 17
#2
In reply to #1

Re: Excel Formulaes

02/22/2011 10:21 PM

Thanks dear,

But not the solution. suppose i am in cell "A1" and without entering anything in cell "A1" i press "TAB" button. the cell "A1" should have "p" written on it after i press "TAB"

__________________
A Good Experience Comes From Bad Judgment But, Good Judgment Comes From Bad Experience
Register to Reply
Guru

Join Date: Aug 2007
Location: Columbia City, Indiana, USA
Posts: 836
Good Answers: 96
#3

Re: Excel Formulaes

02/22/2011 11:03 PM

Hi MT, and welcome to CR4,

Although I have taken some elaborate steps to get solutions in Excel, I tend most of the time to take a shorter, although maybe less elegant, path.

For what you are asking, if I understand you correctly, I would create two sheets in the same workbook ... one for the data entry, and one for the results.

PW had the right idea, but if you use two sheets, the results might be a little cleaner ... take a look:

Sorry for the poor .jpg ... I hop you can see what I am doing here. Let me know if this might help. If not, maybe I can or others can think of another solution.

Kind regards ...

__________________
"Just when I had all the answers, they changed all the questions"
Register to Reply Score 1 for Good Answer
Active Contributor

Join Date: Jan 2010
Location: Ahmedabad
Posts: 17
#4
In reply to #3

Re: Excel Formulaes

02/22/2011 11:14 PM

Hi DCAD,

Sorry to say but this is not what i asked for. there is only one sheet and i am entering data to cell "A1, A2 ....." and other cells like "B1, B2, C1, C2...ETC". What i wanted to do was " if i skip writing or entering in first column(A1,A2.......) the default value should appear in the skipped cells.

hope you are getting me. i can copy and paste "p" in all cells at a go but its not only "p" it has a meaning too.

__________________
A Good Experience Comes From Bad Judgment But, Good Judgment Comes From Bad Experience
Register to Reply
Guru

Join Date: Aug 2007
Location: Columbia City, Indiana, USA
Posts: 836
Good Answers: 96
#6
In reply to #4

Re: Excel Formulaes

02/22/2011 11:40 PM

Hi,

The only alternative would be to write a macro that looks for and replaces "" with "PPPP" (or something else) ... then, after the data is entered, it simply re-populates the form ... writing a macro is pretty much as simple as how you say, "on the go" except after the fact. If you can give me anything more specific, I can try to help.

Kind regards ...

__________________
"Just when I had all the answers, they changed all the questions"
Register to Reply Off Topic (Score 6)
Active Contributor

Join Date: Jan 2010
Location: Ahmedabad
Posts: 17
#8
In reply to #6

Re: Excel Formulaes

02/23/2011 7:25 AM

Thanks DCAD,

I think you are correct, a simple macro can solve my problem. thanks for guiding.

__________________
A Good Experience Comes From Bad Judgment But, Good Judgment Comes From Bad Experience
Register to Reply Off Topic (Score 5)
3
Guru
Technical Fields - Technical Writing - New Member Engineering Fields - Piping Design Engineering - New Member

Join Date: May 2009
Location: Richland, WA, USA
Posts: 21017
Good Answers: 795
#5

Re: Excel Formulaes

02/22/2011 11:23 PM

How about entering "p" everywhere to start with? Entering a genuine value would overwrite it, skipping over it would leave it as is.

__________________
In vino veritas; in cervisia carmen; in aqua E. coli.
Register to Reply Good Answer (Score 3)
Active Contributor

Join Date: May 2010
Location: 36-Tariq Block, New Garden Town, Lahore-Pakistan
Posts: 22
#7

Re: Excel Formulaes

02/23/2011 6:00 AM

Tornado has the best answer. Unless you want to use VBA. Keep It Simple Stupid(KISS)

Register to Reply
Guru

Join Date: Jul 2005
Location: Stoke-on-Trent, UK
Posts: 4496
Good Answers: 137
#9

Re: Excel Formulaes

02/23/2011 8:04 AM

Not quite sure what you're trying to do. First you say "i want to enter text "p" in all the colums which are left blank." then you refer to entries into just one column.

But if you want a column with 1 everywhere but a specified row, you can enter =IF(ROW(A1)=$D$2,"p",1) in the column you're putting entries in, and copy it down. Put 5 (or the number of any row you want p to appear) in D2.

Cheers........Codey

__________________
Give masochists a fair crack of the whip
Register to Reply
Anonymous Poster
#10

Re: Excel Formulaes

02/23/2011 8:24 AM

Control C and Control V are pretty difficult. You could've been done already.

Register to Reply Score 1 for Off Topic
Commentator

Join Date: Dec 2009
Location: Coffeyville, KS
Posts: 59
#11

Re: Excel Formulaes

02/23/2011 3:32 PM

Using VBA,

In the Sheet1 WorkSheet SelectionChange area write the following lines of code.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

If ActiveCell.Value = "" Then ActiveCell.Value = "p"

End Sub

When running, anyplace that the cursor goes, it will write a p unless you put a number or letter including space in that cell.

Pete Olsen.

__________________
Regards, Pete Olsen
Register to Reply Score 1 for Good Answer
Commentator

Join Date: Dec 2009
Location: Coffeyville, KS
Posts: 59
#12
In reply to #11

Re: Excel Formulaes

02/23/2011 4:04 PM

To fill the remainder of the sheet, use this code.

Dim I As Integer
Dim J As Integer


Private Sub Worksheet_Deactivate()

For I = 1 To 35

For J = 1 To 25

If Cells(I, J).Value = "" Then Cells(I, J).Value = "p"

Next J

Next I


End Sub

Switch to sheet 2, then back to sheet 1 and the range will be filled with "p"'s

__________________
Regards, Pete Olsen
Register to Reply
Commentator

Join Date: Apr 2008
Posts: 59
Good Answers: 2
#13

Re: Excel Formulaes

02/23/2011 6:15 PM

There are many ways to do this, even without macros.

1. Select your target area, CTRL-H for Replace, leave the "find" box empty (so it finds empty cells) and replace with "p". May have to tick the "find whole cells only" box.

2. Formula in a blank column, e.g. B1 = if(A1="","P",A1). Drag the formula to full the range next to the target range. With the filled formulas still select, CTRL-C to copy. Select A1 and Edit -> Paste Special -> Values (I have CTRL-SHIFT-V mapped to this via a macro because I use it all the time). Delete the formulas you created in B1:Bxx

Register to Reply
Member

Join Date: Dec 2010
Location: Sydney, Australia
Posts: 5
#14

Re: Excel Formulaes

02/24/2011 3:33 PM

to mtrivedi

If you capture the columns which contain the blanks and use the 'edit - replace' command it will work. Leave the 'replace' line blank and type 'p' in the 'replace with' part then press 'replace all'. Be careful to distinguish between a null cell and a blank cell. If you locate a cell and press 'clear contents' you will get a null cell, but if you press the space bar, followed by the 'enter' key, you will get a blank cell . Both look blank, but the space bar puts an ASCII code 32 character in the cell and 'clear contents' creates null cells.

Register to Reply
Register to Reply 14 comments

Good Answers:

These comments received enough positive votes to make them "good answers".

"Almost" Good Answers:

Check out these comments that don't yet have enough votes to be "official" good answers and, if you agree with them, vote them!
Copy to Clipboard

Users who posted comments:

Anonymous Poster (1); Codemaster (1); Critcho (1); DCaD (2); eaaziz (1); meccano (1); mtrivedi (3); peteolsen (2); PWSlack (1); Tornado (1)

Previous in Forum: Sump Pit or Rain Catcher   Next in Forum: DNA Based Computing

Advertisement