Excel formula question

By jayevans_uk ·
I am using Excel 2007 and I want to create a formula that says - if A2 contains a number xxxxxx, I want Excel to enter a name into cell C2.

This is because I've been given a workbook that contains various sheets and a column for the name hasn't been included, so I want to insert it but not have to go through every line inserting the name - with the potential for making a mistake !

I do hope this can be done as I will want to use it each month until the spreadsheets comes in with the name column already completed.


This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Answers

Collapse -

Teaching the world to Google would result in fewer IT jobs..

by cmatthews In reply to Excel formula question

so according to this, put this in C2 and replicate it down the column.
=IF(A2=xxxxxx, value if true, value if false)

Replicate: Sure, give a hollow laugh, but I used Visicalc before some of you were born..

Collapse -


by yogi_john In reply to Teaching the world to Goo ...

I didn't flinch at replicate. It made perfect sense to me. While I'm old enough to have used VisiCalc I never did.

Collapse -

more details?

by yogi_john In reply to Excel formula question


Is the number xxxxxx linked to a name in a different part of the workbook? If so, you probably want one of the lookup functions.

With data in columns (that is, a row is a record) use vlookup (use Excel's help to determine the parameters).

You might need hlookup instead.

One caution since you mention doing this until the spreadsheets come in with the name: if the (number, name) pairing already exists somewhere it may be better to keep the formula than to hardcode the name. This way there is only one place where a change would need to be made if necessary (e.g., correcting a misspelling or someone changing his/her name).

Collapse -

Use the "If" command

by wwgorman In reply to Excel formula question

In C2 use the "If" command and this will insert the word you select in the command if true. You can leave it blank "if" is untrue, simply leave a space between the commas in the "if" command.

Collapse -

not enough detail to truly answer your question

by Steven.Jones In reply to Excel formula question

Hi Julia,
Reading your problem had me asking a lot more questions. As others have alluded to, it makes a difference if your "contains a number xxxxxx" is truly a specific number you are looking for and want to replace with a specific name or if you are merely looking for number with the format of 'xxxxxx'.

The more information regarding your sample, the better and more clear the answers can be for your problem.

If you are looking for specific numbers to return specified names, you can maintain a separate spreadsheet with the lookup number and names, then as new work comes in, you can use that constant template as your reference source in a 'VLOOKUP'.

If you are just looking for whether the cell value represents a number, you can use the function 'ISNUMBER'.

You can also use Visual Basic code to do it but that'll take a fair bit more work. This is probably not the way you want to go without some expert assistance.

These are just a few solution options that come to mind. As you can see, depending on what your sample is the solution has a variety of options.


Related Discussions

Related Forums