Insert value in different columns - excel-formula

I need formula for all of this can any one give me the formula for:
Insert 2000 in "I", airplane in "H", Visit in "G"
if "C" is london & "D" is Newyork
And
Insert 5000 in "I", airplane in "H", Visit in "G"
if "C" is Karachi & "D" is munich

I'm writing this assuming you're in row 1. Adjust the row number accordingly. You will need a separate formula in each cell (G1, H1, I1, G2, H2, I2, etc.) unless you want to do VBA. If these are the only two columns you're testing then maybe something like this for I1:
=IF(AND($C1="london",$D1="Newyork"),2000,IF(AND($C1="Karachi",$D1="munich"),5000,"")
For columns H and G, copy this text and replace the 2000 and 5000 with appropriate values.
If you have a lot more values to test, it may be worthwhile to make a lookup table. In another sheet, make A1=london, B1=Newyork, C1=london-Newyork, D1=Visit, E1=airplane, F1=2000. Fill in rest and sort. Then in your worksheet, use something like this in I1.
=VLOOKUP(C1&"-"&D1,OtherSheet!A1:F20,6)

Related

Is there any Excel Formula for comparing 2 columns for containing data and counting their occurrence?

Hello everybody.
I ran into some problems when comparing data in columns in Excel / G-Sheets.
I tried to compare 2 columns with company names using the standard formula "=countif (A:A, B2)", where column "A" containing the names of the companies I am looking for (acceptable) and column "B" containing the names of companies that should match with company names in column "A".
For example, in column "A" there is a cell with the name of the company "Apple", and if in column "B" there is no cell with "Apple", it should return "0", but if on the contrary, it should return "1", "2", etc.
But the problem is if a cell with “Apple Inc.” appears in column "B" it will return “0”, although this is the same company. Therefore, I am trying to find a formula where I can count cells not with an exact match, but if it even contains part of the value.
For example, if in column A we have a cell with value "Apple", if in column B we have "Apple Inc.", "GTX Apple", "The Apple" values formula must return "3".
I found some using "*" sign in countif formula, but it does not work as I want. Can someone help me with this issue?
Consider:
=COUNTIF(B:B,"*" & A2 & "*")

how to insert second column of digits in the first in every cell in excel?

I have 2 columns in excel:
however i want it to be 1 column of ranges:
250-424
425-463
etc
how to do it quickly? without copy-pasting every single digit?
assuming you have listed columns "A" and "B", in column "C" (the next column to the right of column "B") enter this formula:
=A1 & "-" & B1
Then copy this formula down next to all of the values and you will have your desired result in column "C".
Here's a GIF to show you what I mean (look at the formula in the formula bar for reference):
Hope this helps.

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:

average cell with text and number based on the value of the text

The cells of my row contain both text and numbers. It is always one letter and two digits.
Example - B30, B35, F30, B40, F32, F34, B33...
I'd like to average the cells that start with "B" separate from the cells that start with "F".
Try this "array formula" assuming data in A2:Z2
=AVERAGE(IF(LEFT(A2:Z2)="B",MID(A2:Z2,2,2)+0))
confirmed with CTRL+SHIFT+ENTER
what I'd do is use an if to separate the b's from the f's into 2 rows and then average both rows. so in an empty row you'd do:
=if(Left(A1,1) = "B", A1, "") and then drag that down for the entire row. that will separate out all the "b"'s, and you can average the row. then do =if(Left(A1,1) = "F", A1, "") on a different row, and drag the formula accross, and average the rows
HTH

Excel find duplicate cells in multiple columns

I have an Excel table with 4 columns and need to find the values that are the same in ALL 4 of the columns and put them aside. Trying to figure out how to accomplish this in Excel.
Example:
Column 1 Column 2 Column 3 Column 4
A1 B1 B1 A1
B1 C2 C1 B1
C2 D3 C2 C2
In this example, both B1 and C2 values comply and must be set aside.
Put this formula in cell D1 and drag and drop it till the end of your values:
=IF(AND(COUNTIF($B$1:$B$3,A1)>0,COUNTIF($C$1:$C$3,A1)>0,COUNTIF($D$1:$D$3,A1)>0),A1,"not found")
For the record, the french version:
=SI(ET(NB.SI($B$1:$B$3;A1)>0;NB.SI($C$1:$C$3;A1)>0;NB.SI($D$1:$D$3;A1)>0);A1;"not found")
To generate a list of values that appear in all four columns, try in cell F2:
=INDEX(A$1:A$3,MATCH(TRUE,COUNTIF(B$1:B$3,A$1:A$3)*COUNTIF(C$1:C$3,A$1:A$3)
*COUNTIF(D$1:D$3,A$1:A$3)*NOT(COUNTIF($F$1:F1,A$1:A$3))>0,0))
confirmed with CTRL+SHIFT+ENTER and fill down as far as needed (this assumes F1 is blank or contains unrelated data)
I couldn't get the above examples to work for myself, so I came up with another solution. Hopefully this will help someone else out there:
=IF(ISNUMBER(MATCH($A2, $B$2:$B$4, 0)), IF(ISNUMBER(MATCH($A2, $C$2:$C$4, 0)), IF(ISNUMBER(MATCH($A2, $D$2:$D$4, 0)), $A2, ""), ""), "")
This checks the value in "Column 1" ("A" column in excel) against the next 3 columns (B,C,D). If the value is present in all three it returns the A column value. If it is not present in all 3, it returns empty. If you would rather return something else, put that something in between the empty quotation marks.
For your data, enter in the lengths of the searched columns, B through D. For example, where it says, "$B$4", put in "$B$99" if the cells go down to 99, but it should work if you put in a generically high number, for example, 99999.
Put this in the row of the first value, so here that would be E2, and then copy it down to every row that has a value in column A.
The function works by just nesting IF statements, and can be expanded or contracted depending on how many columns you want to check against. The function can also be easily modified into a "check if in column B OR column C" function pretty easily.
here is an example for 1 value; I can't generalize since I did not see your data source
Sub test()
If (Range("D6").Value = Range("D6").Offset(0, 1).Value) Then
MsgBox "match"
End If
End Sub
you can also delete duplicates across multiple Columns by using DATA-> Remove Duplicates.

Resources