Excel formula to combine info on different columns - excel-formula

I need to make a spreadsheet with 4 columns and on the 1st column I need a formula to enter and combine the text of the other columns. The spreadsheet will be as follows:
In the 3rd column will contain first names and the 4th column will contain last names. The 2nd column will contain other names. If there are names in the 3rd and 4th columns the 2nd column will always be blank and if there is text in the 2nd column the 3rd and 4th will always be blank.
In the first column I need a formula that will enter and combine the information for the 2nd, 3rd and 4th column.

I think we can just use something like this. Enter the following into A2, assuming your data begins in the second row, and that columns A through D inclusive are the first through fourth columns:
=IF(B2="", C2&" "&D2, B2)
This simple formula says to take the first and last name concatenated together should column B be empty. Otherwise, it takes column B.

Related

Selecting every 3rd row in excel

I am looking to select every third blank row in excel. Once I do that, I need to enter a formula into this third blank row that extracts the contents of a cell below. I would like to have it so this will be done for every third blank. A macro would be fine, I am just not familiar with VBA code so I am not sure where to start.
You'll notice that every third blank row contains the ID from column a in the row below it, and the name from column g below the third blank. Any ideas of how this can be done efficiently?
Just add a column which repeats every 3 rows and filter on that!
You may also be looking for Pivot Tables
Add two columns before column "A", so that your id column becomes column "C".
Now fill all cells with value 1 till the last of your data range in column "A".
In cell "B1" use below formula & fill down till your data
=ISNUMBER(D1)
Now add filter ( Ctrl + Shift + L ). And filter data in column "B" with "FALSE"
If you can follow these steps exactly, you will get all rows you want.
Then use this formula in Than apply filter.

Find last entry of a column if another column contains a certain text

I'm trying to retrieve the last entry value (number) from a column only if a certain text exists in another column within the same row.
I can retrieve the last entry no problem. But I'd like to first match "BabyFoods" in column A before getting the value. Something like the SUMIF function that checks for certain values in a column before adding things in another column.
=LOOKUP(2, 1/(ISNUMBER(Transactions!H9:H1006)), Transactions!H9:H1006)
To find the last cell in Column A that contains BabyFoods, and return the corresponding value from Column H, try...
=LOOKUP(2,1/(Transactions!A9:A1006="BabyFoods"),Transactions!H9:H1006)
To find the last cell in Column A, where the corresponding cell in Column H contains a number, try...
=LOOKUP(2,1/((Transactions!A9:A1006="BabyFoods")*(ISNUMBER(Transactions!H9:H1006))),Transactions!H9:H1006)
Small example, hopefully it's usefull for your situation:
Formula in D1:
=MAX(INDEX((A2:A10="BabyFoods")*(B2:B10="X")*ROW(A2:A10),))
This will return the last row with the combination of criteria "BabyFoods" in column A and "X" in column B. You could apply another INDEX formula, if you would want to retrieve the value of a column.

Sequence number in excel for non blank rows

How to add sequence numbers in excel, wherein the sequence number starts based on the value of the column B. It should not add the sequence if there is no text in the corresponding row of Column B.
So the row 4 should start with 1 since the column B is having some value.
The example sheet is attached.
Also how can i auto update the sequence if i add new row to it.
In A2, enter the following formula and copy down as required.
=IF(B2="","",MAX($A$1:A1)+1)
In A2
=COUNTA(B$2:B2)
and fill down

In Excel, comparing a cell with text to see if it is contained in any cells of another column of text.

I have one column that has the first and last name of subscribers and a second column that just has the last name of the subscribers. I need to see if the last name in the second column is contained in any of the names in column 1. Is this possible in Excel?
If the list of full names is in column A (in a firstname surname format) and the name you're checking is in cell B1, then you can use the formula:
=COUNTIF(A:A,"* "&B1)

Exporting excel to csv when field on multiple rows

I have been given an excel spreadsheet to convert to csv. The problem is that one of the fields is a description field in which in sentence in the description is on a separate row. So for example the first product is on row 1. The first line of the description is on row 1, the second line of the desription is on row 2, with all the other columns in that row empty. Most products have about 6 rows of description. The next product then starts on, say row 7.
I have tried exporting the data but naturally excel creates one line in a csv file per excel line so most of the rows are empty rows with just one sentence of description (e.g. , , , "sentence 2", , )
Please can you advise if there is a way to handle this?
Thanks
One way to deal with this is to get all of the description lines into a single cell in the same row as the rest of the fields, and then get rid of the mostly-blank rows that just have the extended descriptions.
Lets assume your spreadsheet has product information in columns A and B, and the description fields in column C, like this:
In D1, enter the formula
=C1
In D2, enter the formula
=IF(A2<>"",C2,D1&"/"&C2)
Fill this down the rest of column D, producing this:
For each item, column D now contains the full description on the last row for that item. Now we're going to get that value back up into the row with the rest of the data fields for the item. In E1, enter the formula
=IF(A1<>"",OFFSET(D1,MATCH(TRUE,LEN(A2:A20)<>0,0)-1,0),"")
Hit Control-Enter to enter it as an array formula, and then fill down the rest of column E, producing this:
You need to enter one extra value after the last row (the "End" in the image above) to make this work. Now you have the full description for each item in column E. Copy column E, paste values, sort by column E to group together all the blank rows, and get rid of all the rows that don't have values in column E. You can get rid of columns C and D at this point if you want to, which leaves you with this, which you can now export to CSV:
There's a small spreadsheet that illustrates this at http://www.filedropper.com/multiline
I'd suggest to export one line per product with whole description in one place. Let's say you have a product name in column A and product descriptions in column B. You can put all descriptions in one cell with this formula (this formula assumes that you start it with cell C1):
=IF(ISBLANK(A2);B1&C2;B1)
Drag this formula till the last row, copy-paste as values (copy column C and paste it as values) and then delete "empty" (by column A) rows. Here you have one row per product with description in one place.

Resources