Excel logical statement - excel

I want to accomplish a certain task in excel.
I want to practice 10 key skills.
I have typed numbers in column A(cells, A1,A2,A3,etc.). I want to retype them in column B. Then (if column B matches column A) would like to have the word "OK" appear in column c. Can write the simple IF statement for A1=B1. Do not know how to make the statement automatically apply to other cells(i.e if A2=B2, A3 =B3, etc).
Thanks. CD

In cell 'C1'
=If(A1=B1,"OK", "")
Now drag this cell down col C until your last row. Excel will auto increment A1 & B1 to A2 & B2 and so on... unless you use absolute referencing which is the dollar sign like this $A$1 for example.

Related

filling excel column automatically where another column is not null

I want to fill an excel column with a specific value where another column in the same sheet is not null(I've used '-' for all the empty cells). Can I automate this?
For example, in the screenshot, where ever I have a value, I want to insert 'Hi' (Only at the places with a value) and omit where there is blank space represented by '-'. Also, it should not edit the values in B column if there is anything already present in it.
You can use if function to do this task. Suppose you have data to test in Cell A1 then you can enter Formula in cell B1 as =if(A1<>"-","Hi","") this means if Data in cell A1 is not - then enter Hi in cell B1 else keep B1 empty. See Screenshot attached.
You can do the following: suppose column A is full of values and you want to fill column B with "-". First, write the value "-" in the cell "C1", then select column B and write in B1 =$C$1 and then press Ctrl+Enter Key that's it
=IFERROR(IF(B1="","-",COUNTBLANK(INDIRECT("B1:B"&ROW()-1))+1),1)
Or avoiding INDIRECT:
=IFERROR(IF(B1="","-",SUM(IF(INDEX(B:B,SEQUENCE(ROW()-1))="",1))+1),1)

If A1 = A2, and B1>B2 then hide Row 2. What formulas/rules to use and where?

In Excel I have a problem...I don't know many formulas/rules.
This is my case:
Scenario 1)
A B C
1.| Drw....3350......03
2.| Drw....3350......02
This is my desire:
I want to hide row 2.
Scenario 2)
A B C
1.| Drw....3350........03
2.| Img.....3350........02
This is my desire:
I want to keep both rows.
My problem in words:
Scenario 1: Because A1 & A2 + B1 & B2 are the same, I want to hide the row with the smallest number in column C.
Scenario 2: Because A1 & A2 are different I want to keep both rows, even though B1 & B2 are the same.
This is a simplified example. Column A could consist of hundreds of rows with mixed values. However, Column A is text and column B and C are values.
There will not be such a case when C1 & C2 are the same. (only if someone typed in wrong)
What I am asking:
I don't know what formulas or rules to use in Excel and would prefer to not use VBA for this. Seems like such a simple task but I just don't know how to.
Anyone?
In your Title you mention and B1>B2 and then give two examples in both of which the 'B' values are the same, so assuming you mean to hide the lower C value where the A values match and the B values match then in a helper column, say E:
=A2&B2
and in another column (I chose H):
=AND(MIN(IF(E7=E:E,C:C))=C7,MAX(IF(E7=E:E,C:C))<>C7)
entered with Ctrl+Shift+Enter and copied down to suit. Then filter that column to select for FALSE:

Excel foreach over multiple columns

Hi I'm a complete noob to excel and looking to do something like this:
For each item in column A
Get its corresponding value in column B and populate in column D
get its corresponding value in column C and populate in column E
the main problem I'm having is the number of rows in each column may differ.
I think I would need a macro to do this.
How could I do this in Excel?
If you don't want to resort to a macro and the presence of something in column A dictates when you want to see something in column D & E, then consider the following functions:
IsBlank( A1) returns true if A1 is empty else false.
If( condition, trueResult, falseResult) returns the corresponding result based on the condition.
So for example, you could write the formula for D1 to be:
=If( IsBlank(A1), "", B1 * 2)
would set D1 to be twice that of B1. You can now copy and paste that formula down the D column to as far as you need and because the formula uses relative addressing (B1 instead of $B$1) the formula is updated for each cell to work on the corresponding row.
If this doesn't solve your issue then more detail on your problem would be useful.

Excel: search if a specific text exists in a column

I have two columns. Each cell in column A contains a full sentences and each cell in column B contains a word or phrase. I would like to check if the contents of each cell in column B appears in one of the cells in column A---it could appear in multiple cells in column A or in no cells. The output just needs to be a yes or no (and should be spit out in column C) for my purposes, but it would be neat to return the number of times each column B word came up somewhere in Column A.
So far I haven't figured out how to take a discrete string of letters (already printed in one cell) and search across a range in a column. Not sure if this is beyond the regular excel functionality.
Thanks very much for your help!
Use array formula like this:
=SUM(IF(ISERROR(SEARCH(B1,A:A,1)),0,1))
enter in formula bar then press CTRL+SHIFT+ENTER.
Hope this helps.
Put formula in C.
Try This :
=countif(a:a,"*" & b2 & "*")>0 gives you result in True/Flase
To get the occurrence
=countif(a:a,"*" & b2 & "*")
To get YES/NO
=if(countif(a:a,"*" & b2 & "*")>0,"YES","NO")

Formula in all cells in a column

Simple question:
I want to create a formula which, in column Cn, will compute the values of An * Bn.
example
column C1 = column A1 * column B1
column C2 = column A2 * column B2
column C3 = column A3 * column B3
...etc
all the way down to
column Cn = column An * column Bn
Thanks
Easy way to do it.
Highlight your formula cell.
The lower right corner should turn into a + sign.
Click on that + sign and drag it for as many rows as you like.
Alternatively, you can do this:
Highlight the formula cell.
Ctrl+C to copy.
Click on the C column.
Hit enter.
Now with the second method, it may start to lock up on you because of the large number of cells it has to compute. Just hit escape and it'll go back to normal (but some cells may not be filled in, depending on how early you hit escape.)
In what context are you trying to create a formula? If in VBA, you can do something like:
Range("A1").FormulaR1C1 = "=RC[-2]*RC[-1]"
This formula is in R1C1 format. It tells the system to take the value two columns to the left of the cell containing the formula and multiply it by the column to immediately to the left of the cell containing the formula. This same formula could be entered in all rows of column C and would automatically adjust based on the row.

Resources