inserting texts in cell based on conditions

Hi,

I would very much appreciate if someone could help me 
solving a problem, illustrated by the following example:

Column    A    B    C
1         1         "LB"
2              1    "DK"
3                        
4         1    1    "LB/DK"


If there's a 1 in column A, the corresponding cell in 
column C should get the text "LB" inserted into it.

If there's a 1 in column C, the corresponding cell in 
column C should get the text "DK" inserted into it.

If both column A and B have ones in them, the 
corresponding cell should get the text "LB/DK" inserted 
into it.

Haven't been able to figure this out and would appreciate 
any help and suggestions.

Cheers
Nic
0
nico1448 (1)
8/27/2003 6:23:09 AM
excel.misc 78881 articles. 5 followers. Follow

4 Replies
628 Views

Similar Articles

[PageSpeed] 15

Nic,

Try   =IF(A2=1,IF(B2=1,"LB/DK","LB"),IF(B2=1,"DK",""))

regards,

JohnI


"Nic" <nico@alt.cz> wrote in message
news:08fe01c36c63$af8e3340$a301280a@phx.gbl...
> Hi,
>
> I would very much appreciate if someone could help me
> solving a problem, illustrated by the following example:
>
> Column    A    B    C
> 1         1         "LB"
> 2              1    "DK"
> 3
> 4         1    1    "LB/DK"
>
>
> If there's a 1 in column A, the corresponding cell in
> column C should get the text "LB" inserted into it.
>
> If there's a 1 in column C, the corresponding cell in
> column C should get the text "DK" inserted into it.
>
> If both column A and B have ones in them, the
> corresponding cell should get the text "LB/DK" inserted
> into it.
>
> Haven't been able to figure this out and would appreciate
> any help and suggestions.
>
> Cheers
> Nic


0
8/27/2003 6:54:51 AM
One way:

Put in
C1:=IF(AND(A1=1,B1=1),"LB/DK",IF(A1=1,"LB",IF(B1=1,"DK","")))
Copy down col C

Nic <nico@alt.cz> wrote in message
news:08fe01c36c63$af8e3340$a301280a@phx.gbl...
> Hi,
>
> I would very much appreciate if someone could help me
> solving a problem, illustrated by the following example:
>
> Column    A    B    C
> 1         1         "LB"
> 2              1    "DK"
> 3
> 4         1    1    "LB/DK"
>
>
> If there's a 1 in column A, the corresponding cell in
> column C should get the text "LB" inserted into it.
>
> If there's a 1 in column C, the corresponding cell in
> column C should get the text "DK" inserted into it.
>
> If both column A and B have ones in them, the
> corresponding cell should get the text "LB/DK" inserted
> into it.
>
> Haven't been able to figure this out and would appreciate
> any help and suggestions.
>
> Cheers
> Nic


0
demechanik (4694)
8/27/2003 7:08:15 AM
=IF(A1,"LB","")&IF(A1+B1=2,"/","")&IF(B1,"DK","")

--
Mike

Ref to "Nic" <nico@alt.cz> wrote in message news:08fe01c36c63$af8e3340$a301280a@phx.gbl...
0
mike22p (25)
8/27/2003 7:50:06 AM
Assuming it is acceptable to have zeros to replace blank cells, a
"binary" like set-up using VLOOKUP might be one possible way to
go.

This avoids having "indecipherable and hard-to-maintain" nested
IF()'s and also averts the limit faced for nested IF()s (albeit
there are ways to get around this limit).

Assuming the input cols are cols A to D

Set-up a vlookup table (sample below) in a 2 col range,
say in H1:I12, and name this range: List

(yes, a fair amount of one-time effort is required to set this
up. And you got to cover all the "binary" like permutations of
1's and 0's depending on the number of input cols involved. The
sample set below *doesn't* cover all permutations.)

0_0_0_0  LB
0_0_0_1  DK
0_0_1_0  LB/DK
0_0_1_1  AB
0_1_1_1  CD
1_1_1_1  EF
1_0_0_0  AB/CD
1_0_0_1  AB/EF
1_0_1_1  GH
1_1_0_1  IJ
1_1_1_0  GH/IJ
1_1_0_0  KL

Put in E1:=VLOOKUP(A1&"_"&B1&"_"&C1&"_"&D1,List,2,FALSE)

If A1:D1 contains 1,0,0,1 then E1 will return AB/EF

Copy down col E

Nic <nico@asco.cz> wrote in message
news:0f4f01c36d01$c5be6510$a001280a@phx.gbl...
> Big thanks to all of you, much appreciated. However, my
> example was simplified in that there are several columns I
> would have to check for value and writing IF for all
> combinations become tedious (is it n^2 -1??) Would there
> be another way of achieving this or will I have to bite
> the bullet and write a (rather) lengthy if statement?
>
> Cheers
> /Nic


0
demechanik (4694)
8/29/2003 9:20:31 AM
Reply:

Similar Artilces:

Copying and pasting a series of cells
When I copy and paste the following cell > =IF('13'!B13>0,'13'!B13,NA()) to the remainder of the days of the month, what I get is > =IF('13'!B14>0,'13'!B14,NA()) > =IF('13'!B15>0,'13'!B15,NA()) > etc But what I want to get is > =IF('14'!B13>0,'14'!B13,NA()) > =IF('15'!B13>0,'15'!B13,NA()) > etc I'd even settle for > =IF('13'!B13>0,'13'!B13,NA()) > =IF('13'!b13>0,'13'!B13,NA()) > etc whereafter I could just modify the fo...

How do I insert Roman Numerals?
New to Word 2007 would someone please explain to me how to insert Roman Numerlas in my document? "ckj" <ckj@discussions.microsoft.com> wrote in message news:6CF0C580-BA6E-463D-B4FD-E6A6FDD9E814@microsoft.com... > New to Word 2007 would someone please explain to me how to insert Roman > Numerlas in my document? Just type them... I II III IV V VI VII VIII IX X XI etc etc. Type a number e.g. 21, select it and run the following macro Dim oRng As Range Set oRng = Selection.Range oRng.Fields.Add oRng, 34, oRng.Text & " \*Roman"...

Count with Hidden cells
Is there a way to count the number of text filled cells excluding the cells that I have hidden? Depends on the version of excel, excel 2003 works like =SUBTOTAL(103,A1:A10) won't count hidden cells -- Regards, Peo Sjoblom (No private emails please) "Stretch" <Stretch@discussions.microsoft.com> wrote in message news:9F387E47-FC1F-4AEB-8A6C-2B37BC012DD1@microsoft.com... > Is there a way to count the number of text filled cells excluding the > cells > that I have hidden? What does the 103 stand for? "Peo Sjoblom" wrote: > Depends on the v...

Insert trigger
Looking for some advice on SQL 2005. I have a table that will usually be populated by an SSIS package. I want to set the "loaddate" column to the current time after a record is inserted. Should i do this via trigger or should i just build a step in the SSIS package to update the column after the file loads? If trigger is the way to go, what is the syntax to create the after insert trigger? Thanks in advance. You can create a default constraint on the table set to CURRENT_TIMESTAMP. That will handle the automatic date assignment without any need for coding. -...

Auto correct text changes
I am editing a document in word 2007 that has been saved in compatible mode. Whe I try to turn one heading into italics or bold it changes all the headings in the document to the same formatiing. Can any one help me to stop this happening. If I then press undo all the other changes revert back and not the one I have just made. I can't keep pressing undo everytime I make a change. I just want it to change the words I am highlighting See http://word.mvps.org/faqs/formatting/wholedocumentreformatted.htm. -- Stefan Blom Microsoft Word MVP "David Rudman"...

inserting hrs and minutes
I have a cell in my time card that displays total weekly time -ex- "40:15" is there a way to make it more like this...40hrs,15mins -- Message posted from http://www.ExcelForum.com Use a custom format hh"hrs",mm"mins" -- Regards, Peo Sjoblom "-Brian-H- >" <<Brian-H-.110wgs@excelforum-nospam.com> wrote in message news:Brian-H-.110wgs@excelforum-nospam.com... > I have a cell in my time card that displays total weekly time -ex- > "40:15" is there a way to make it more like this...40hrs,15mins ? > > > ...

how do I filter on text format in Excel?
I have a workbook containing text that I wish to filter based on the format of some words. IOW, for instance, all records (rows) with cells containing text of a certain font color, or perhaps characters with the strikethrough mark. I'm relatively familiar with advanced filtering, but this appears to be something requiring a "filter by formula". Does anyone have any experience in this area? It is not in any built in function in Excel only way this would be possible would be to use a UDF (a function written using VBA) in a help column and then filtger on that help column pl...

Worksheet name in cell formula
I asked this question a while ago and got a prompt answer which I thought was what I wanted but alas its not... I want to be able to change my worksheet names.....ie: from Sheet 1, Sheet 2, etc etc.....to something more meaningful.....eg Sales, Expenses....etc etc.... and have these changes reflect on the worksheet. For example, I might want Sheet 1 Cell A1 to say.....This is the Sales worksheet (assuming I have renamed it to Sales). The answer I was given some time back worked.....but it changed the formula on every worksheet to reflect the name of the last changed sheet. By this I mean.....

conditional formulating
Hi, like to know if there's other ways besides validating the data changes by colours for conditional formating. Looking for audio validation..ie having the spreadsheet alerting me by making a sound when there's changes in the data. Having pop up alerts will do. THe main purpose is that I do not want to keep on monitoring the spreadsheet all the time to capture the changes in data. The data are linked real time to websites, ie Foreign exchange rates. use msgbox and it'll pop up if you are running a macro which goe through the data. really need more info to be more help :...

insert an interactive excel file into word web page
I'm trying to insert a excel file into a word document with text, and then save it was as a web page, but I want to keep the excel part interactive. Any ideas? ...

Insert | File > Attachmnet-Button Drop Down ;What is the difference between Insert and Insert As Attachmnet
re: "Outlook2003, File-Insert-Options" On making new-email with Attachment-File(s), ** File Menu | Insert | File >>> (Brows and select File to insert ) then we can see the button "Insert", and write side Drop Down Arrow lower-right side of Dialog Box; If it clicked, we can see three options as follows: ** Insert Insert as text Insert as Attachment I can not recognize/understand the difference between "Insert" and "Insert as Attachment" *** What is the difference between Insert and Insert As Attachment ? I would appreciate y...

VLOOKUP and cell color problem.
I have a spreadsheet to create a quotation/estimate and I use the VLOOKUP function to retrieve the price of an item on another worksheet. In that worksheet, I have several pricelists from various suppliers but one column gives me the lowest price and changes the cell color associated with the supplier so I know from which supplier the price comes from. Now my main quotation page displays the cheapest price but does not pass along the cell color which I need so i can tell, by looking at the quotation, which supplier i need to order each item from. Is there a way to pass along not only the va...

Inserting Hyperlinks in a Protected Sheet
Hi I run Excel 2000 and I have a protected worksheet that I share wit users in my organisation. I want to allow the insertion of a hyperlin to a specific file type within a specified directory on our server. 3 Questions: 1.Protection on disables the insert hyperlink command. Can this b overcome with worksheet activate code? 2.Can I limit the types of files (preferably by requiring the file t meet a mask format eg "z-*.xls")? 3.Can I limit the directory that can be linked, by referring to pathname stored in a cell on the active sheet? Would appreciate your suggestions. Thanks S...

how do I format text as strikethrough in Publisher 2003?
I am copying over text from a WordPerfect document into Microsoft Publisher 2003. Text that has been formatted as "Strikethrough" in the WordPerfect document comes over as plain text with no strikethrough. I have even tried to just import the document which it looks like it does fairly well at, except that all text formatted as strikethrough is imported as plain text. I can possibly believe that Publisher does not have any way to format text in this way, but I have looked everywhere and cannot figure out how to format the text in this way. Can anyone help? You will have to ...

Insert with a where condition
Hi, sql 2005 I have an insert statement that is ignoring the where condition. That is, I want to insert records when they do not already exist in the destination table. INSERT INTO dbo.tblmnuGroupPerm ( gId ,mtfID ,... ) SELECT @gID ,mtfID ,... FROM dbo.locmnuTabFunction AS ltf WHERE ltf.mtfID NOT IN ( SELECT gp.mtfID FROM dbo.tblmnuGroupPerm AS gp WHERE gp.gId=@gID AND gp.Deleted=0 ) Any ideas or recommendations appreciated :-) Many thanks, Jonathan It's OK... <oops "redFace">I did not correctly se...

Insert
I want to overtype in a Publisher text box. I find I can only insert. The "insert" key doesn't do anything. ...

how to insert data in a table
Hi Exprets; I am creating an access database in which I want to insert data in already created table. Kindly help. Regards, Vikky Vikky <love.excel@gmail.com> wrote in news:1194124711.012302.269990 @e34g2000pro.googlegroups.com: > Hi Exprets; > > I am creating an access database in which I want to insert data in > already created table. > > Kindly help. > > Regards, > > Vikky > Data from where? Do you want to import it from excel, from a text file, copy it from another table or type it in manually? -- Bob Quintal PA is y I've altere...

Conditional Formating, contain space
Hi All, How do I HIGHLIGHT a block of data that CONTAIN space?? For an Example, COLOUMN A1-A1000 contains TEXT data. I would like to highlight those cells that contains data. Thanks in advance. New Rule>Use a formula. =NOT(ISBLANK(cellref)) Gord Dibben MS Excel MVP On Wed, 3 Feb 2010 15:51:01 -0800, apache007 <apache007@discussions.microsoft.com> wrote: >Hi All, > >How do I HIGHLIGHT a block of data that CONTAIN space?? > >For an Example, COLOUMN A1-A1000 contains TEXT data. >I would like to highlight those cells that contains data....

How do you insert page numbers larger than 1000?
I have my purchase orders set up as a Publisher document. When our organization upgraded from Publisher 2000 to Publisher 2002, the new version set parameters on the page numbers. This was one of those things that worked just fine in the previous version... Does anyone know how to turn it off or change it? Hi mregen (mregen@discussions.microsoft.com), in the newsgroups you posted: || I have my purchase orders set up as a Publisher document. When our || organization upgraded from Publisher 2000 to Publisher 2002, the new || version set parameters on the page numbers. This was one of those...

insert downloads into power point
i downloaded an application called "BioDigital Simulator" of an animated cleft lip/palate surgery and need it put into my power point presentation, but can't fiugre out how to do so.... very frustrating... What kind of file is this application? Is it a video? If so, what kind? MPEG? AVI? MOV? Or is it an EXE file? Something else? Which version of PPT are you using? -- Echo [MS PPT MVP] http://www.echosvoice.com What's new in PPT 2010? http://www.echosvoice.com/2010.htm Fixing PowerPoint Annoyances http://tinyurl.com/36grcd PowerPoint 2007 Complete Makeover...

Insert dataset to another database
I'm posting this to this group also since it pertains to queries, primarily. Hello, Using VB6/ADO, I'm thinking I can create a recordset and insert it into another table in a different Jet database, all within the execution of a single query. But, I can't seem to get it to work, even in an experiment in Access 2K. My sql in Access 2K: SELECT D.lorder as Ord, A.Lorder FROM [;Database = C:\MyDocuments\Acc2K\Wrk.mdb].OrdersData as A INNER JOIN [;Database = C:\Access\Work\Sales06.mdb].Detl1 as D On D.Lorder = a.lorder WHERE ((D.fg)= 'MXX-NC' Or (D.fg)= 'MXX.NC')...

Insert a blank row
Hi, I need some help to insert a blank row in a range where column A has a series of dates. There will be several of the same dates and I need to both sort the dates and then insert the blank row at the end of each sequence. In the blank row I need to total figures that will be in columns B through to G. Thanks, Jim S Hi Jim maybe an easier solution 1. Sort your data (use 'Data - Sort', e.g., column A ascending) 2. Use 'Data - Subtotals' This will insert a row after each date and calculate subtotals automatically for you HTH Frank anon wrote: > Hi, > I need some...

text field validation 12-07-04
I am trying to create an validate event for Text fields on CRMAccount address fields. Whenever you try to change the values of these fields, it should alert the message. Here is the code like: In sfa\accts\acct_cont.js file, under window.OnLoad function: function window.onload() { ..... .... try { crmForm.address1_line1.onblur = validate; } catch (e) { alert("Error: " + e.message); } } function validate() { if (crmForm.ownerid.value == "{669282E2-2725-47A1-8234-3BD107C49487}") { alert("Not a authorized user. Please notify ...

Enable Command Button After Entering Text
I am a beginner with Excel VBA programming and would greatly appreciate any advice on how to accomplish the following. I created a user form with three text boxes (txtName, txtDescription, txtProcess) and two command buttons (cmdAdd, cmdCancel). I do not want the cmdAdd button enabled until a user enters valid text into both the txtName AND txtDescription text boxes. I have the Enabled property for the cmdAdd button set to False. How and where do I code the procedure to set the cmdAdd control's Enabled property to True as soon as the user has entered valid text in BOTH the txtNa...

help with conditional formula for a group of values
I need help with a conditional formula. Lets pretend A1 has a value of 15 and in the A2 cell I wish to have a conditional formula that states if the A1 value is greater than > 10 and less than < 20 - if this is true (which it is) the value will be "dog." If A1 has a value of 21 then this falls in the "cat" category i need to add another condition so that if the value in A1 is greater than >20.1 and less than <28.99 if this is true than the value input for A2 should read "cat." All false inputs should read "0" so if the A1 cell has ...