Trending February 2024 # How To Insert Multiple Rows In Excel # Suggested March 2024 # Top 10 Popular

You are reading the article How To Insert Multiple Rows In Excel updated in February 2024 on the website Kientrucdochoi.com. We hope that the information we have shared is helpful to you. If you find the content interesting and meaningful, please share it with your friends and continue to follow and support us for the latest updates. Suggested March 2024 How To Insert Multiple Rows In Excel

Inserting rows in Excel is one of the most basic stuff that we do almost everyday. And there are many ways to do this.

Now there could be various situations where you need to insert rows in Excel. For example, you may want to insert a single row, or multiple rows that are all together, or multiple rows that are not together.

How to Insert Multiple Rows in Excel

In this tutorial, you’ll learn four different ways to do insert multiple rows in Excel.

Using Keyboard Shortcuts.

Using Insert Options.

Using Mouse + Keyboard (super trick).

Using Insert Copied Cells Option.

You can insert multiple rows in Excel using more than one keyboard shortcut.

Here is the first one:

Select the cell above which you want to insert multiple rows in Excel.

Press Shift + Space-bar to select the entire row.

Once the entire row is selected, press Control and hit the plus key (+) from the numeric keypad.

If you don’t have the numeric keypad, press Control and Shift and plus key (+) on the regular keyboard.

This will insert a single row right above the row that you selected.

Once you have inserted a row, you can repeat the same action by using the F4 key.

To do this, just select the row above which you want to insert a row and press F4. Hitting the F4 just repeats the last action.

What if you want to insert multiple rows in Excel at one go?

In the above example, we saw how to insert one row using the keyboard shortcut. If you want to insert multiple rows at one go, you can easily do it with a slight twist.

Here is how to do it:

It does not matter if the rows have data or are empty. This technique works in all cases.

Use the keyboard shortcut Control and Plus key (or Control and Shift and Plus key if you have a regular keyboard).

This will automatically enter the same number of rows as you selected to begin with. So if you selected four rows, it will insert four rows above it (as shown below):

Here is another keyboard shortcut that you can use:

Hold the ALT key and Press I followed by R.

You can also use the Insert functionality in Excel to insert multiple rows in Excel.

Here are the steps to use this:

Select the rows above which you want to insert the rows. For example, if you want to insert 4 rows between Row #3 and #4, select four rows staring from Row #4.

This will enter four rows above between Row #3 and #4 (as shown below):

You can also use the Insert Option available in the Home chúng tôi use it:

Select the rows above which you want to insert the rows.

#3 Using Mouse + Keyboard Shortcut

This one is a super trick.

If you want to insert multiple rows above or below a row, here are the steps:

Select a row above or below which you want to insert rows.

You will notice a small green square at the end bottom right of the row number.

Hover your mouse on that green square and press Control + Shift on your keyboard. You will notice that the mouse icon changes from a plus to a double line icon with arrow on both sides.

This is one of the best ways to quickly insert any number of rows.

Another quick way to insert multiple rows in Excel is to copy a blank row and paste in where you want. Since you are copying a blank row, it would be the same as inserting a new row.

Here is how to do this:

Select a blank row and copy it.

Select the rows above which you want to insert the new rows. Select as many rows as you want to insert.

This will insert rows above the rows that you selected (as shown below):

These are four ways you can use to quickly insert multiple rows in Excel.

You're reading How To Insert Multiple Rows In Excel

Rows To Columns In Excel (Examples)

Excel Rows to Columns (Table of Contents)

Start Your Free Excel Course

Excel functions, formula, charts, formatting creating excel dashboard & others

Rows to Columns in Excel

In Microsoft Excel, we can change the rows to columns and columns to rows and vice versa, using TRANSPOSE. We can either use the Transpose or Transpose function to get the output.

The transpose function normally returns a transposed range of cells which is used to switch the rows to columns and columns to rows and vice versa, i.e., we can convert a vertical range of cells to a horizontal range of cells or a horizontal range of cells to a vertical range of cells in Excel.

For example, a horizontal range of cells is returned if a vertical range is entered, or a vertical range of cells is returned if a horizontal range of cells is entered.

How to Convert Rows to Columns in Excel using Transpose?

It is very simple and easy. Let’s understand how to convert rows to columns in Excel using examples.

You can download this Convert Rows to Columns Excel?Template here – Convert Rows to Columns Excel?Template

Steps to use transpose:

Start the cell by selecting and copying an entire range of data.

Choose to paste special, and we will find the transpose button.

We will get the result converted to rows to columns.

Example #1

Consider the below example where we have a revenue figure for sales month-wise. We can see that month data are row-wise and Part number data are column-wise.

If we want to convert the rows to columns in Excel, we can use the transpose function and apply it by following the below steps.

First, select the entire cells from A To G with data information.

Copy the entire data by pressing the Ctrl+ C Key.

Now select the new cells where exactly you need to have the data.

Choose the option paste special.

Select the fourth option in paste special, transpose, as shown in the below screenshot, highlighted in yellow.

In the above screenshot, we can see that rows have been changed to the column, and the column has been changed to rows in Excel. This way, we can easily convert the given data from row to column and column to row in Excel. For the end-user, if there is a huge amount of data, this transpose will be very useful, and it saves a lot of time instead of typing it, and we can avoid duplication.

Example #2

In this example, we will convert rows to columns in Excel and see how to transpose the employee salary data by following the steps below.

Consider the above screenshot, which has the id number, emp name, HRA, Allowance, and Special Allowance. Suppose we need to convert the data column to rows; in these cases, the TRANSPOSE function will be very useful to convert it, which saves time instead of entering the data. We will see how to convert the column to a row with the below steps.

Once you copy the data, choose the new cell location.

We will get the paste special dialogue box.

Choose the Special Paste option.

Select the Transpose option in that, as shown below.

Once you have chosen the transpose option, the Excel row data will be converted to the column, as shown in the below result.

In the above screenshot, we can see the difference that the row has been converted to columns; in this way, we can easily use the transpose to convert horizontal to vertical and vertical to horizontal in Excel.

Transpose Function

In Excel, a built-in function called Transpose Function converts rows to columns and vice versa; this function works like transpose. i.e., we can convert rows to columns or columns into rows and vice versa.

Syntax of Transpose Function:

Array: The range of cells to transpose.

When a set of an array is transposed, the first row is used as the first column of an array, and in the same way, the second row is used as the second column of a new one, and the third row is used as the third column of the array.

If we use the transpose function formula as an array, we have CTRL+SHIFT +ENTER to apply it.

Example #3

In this example, we will see how to use the transpose function with an array with the example below.

Consider the below example, which shows weekly sales data, where we will convert the data to columns to row and row to column and vice versa using the transpose function.

Select the row you want to transpose.

Here we are going to convert the MONTH PLAN to the column.

We can see that there are 11 rows, so to use the transpose function, the rows and columns should be in equal cells; if we have 11 rows, then the transpose function needs the same 11 columns to convert it.

Choose exactly 11 columns, use the Transpose Formula, and select an array from C1 to C11, as shown in the below screenshot.

Now use CTRL+SHIFT +ENTER to apply as an array formula.

Once we use the CTRL+SHIFT +ENTER, we can see the open and close parenthesis in the formulation.

We will get the output where a row has been changed to a column, shown below.

Use the formula for the entire cells to get the exact result.

So the Final Output will be as below.

Things to Remember about Convert Rows to Columns in Excel

The transpose function in Excel is one of the most useful functions, as it allows us to rotate the data without altering its information.

If any blank or empty cells exist, transpose will not work, giving the result zero.

While using the array formula in the transpose function, we cannot delete or edit the cells because all the data are connected with links, and Excel will throw an error message that “YOU CAN NOT CHANGE PART OF AN ARRAY.”

Recommended Articles

This has been a guide to Rows to Columns in Excel. We discuss converting rows to columns in Excel using transpose, practical examples, and a downloadable Excel template. Transpose can help everyone to convert multiple rows to a column in Excel easily and quickly. You can also go through our other suggested articles –

How To Sort Alphabetically In Excel With Multiple Columns

Ever find yourself staring at a heap of info in Excel, scratching your head about how to make it all neat and tidy? You’re in the right place! Today, we’re tackling one of Excel’s superpowers: sorting data alphabetically across multiple columns.

In this article, we’ll get our hands dirty with Excel and teach you how to sort data alphabetically across multiple columns. We’ll break down the basics of how Excel’s sorting function works, and guide you through the process step-by-step, using clear, easy-to-follow instructions.

So, let’s dive in and transform you into an Excel whiz!

Alright, before we dive into the nitty-gritty of multi-column sorting, let’s first take a moment to understand what Excel’s sorting function is all about.

Think of the sorting function as your own personal data organizer. It’s a feature that allows you to arrange your data in a particular order — and that’s super handy when dealing with tons of information. Excel’s sorting function is like having a personal librarian who knows exactly where each book should go.

When it comes to sorting, Excel gives you two options: ascending or descending order.

Ascending order means arranging the data from smallest to largest, or in the case of text, from A to Z.

Descending order means arranging the data from largest to smallest, or from Z to A for text.

But here’s where things get a bit more interesting. Excel doesn’t limit you to sorting just one column. It lets you sort multiple columns, which means you can arrange your data based on more than one criterion.

Imagine you’re dealing with a list of names, with separate columns for first name and last name. Excel allows you to sort the list by last name and then sort those with the same last names by first name. Pretty cool, right?

So, in a nutshell, Excel’s sorting function is a powerful tool that helps you make sense of your data. It organizes your information in a logical, easy-to-read manner, saving you time and effort.

Now that we’ve got the basics down, let’s move on to the fun part — learning how to sort data alphabetically in columns!

Before we jump into the deep end with multi-column sorting, let’s take a quick dip in the shallow end by sorting a single column in ascending order and then descending order.

To sort a single column in ascending order, follow the below steps:

Step 1: Open your Excel worksheet

Kick things off by opening the worksheet that has the raw data you want to sort.

Step 2: Select the data to be sorted

Step 3: Go to the Data tab and find the Sort and Filter group

If you want to sort a single column in descending order, you have to follow the same process. Here are the steps:

Step 1: Open your Excel worksheet

Kick things off by opening the worksheet that has the data you want to sort.

Step 2: Select the data to be sorted

Step 3: Go to the Data tab and find the Sort and Filter group.

And there you have it! You’ve just sorted a single column in ascending and descending order in Excel. Now, let’s take things up a notch and sort multiple columns.

Alright, now that you’ve mastered single-column sorting, it’s time to turn up the heat and tackle multiple columns. Don’t sweat it, though — if you’ve got the single column down, this is just a hop, skip, and jump away.

Step 1: Open your Excel worksheet

Start by opening the worksheet that holds all the data you want to sort.

Step 2: Select your data

Step 4: In the Sort dialog box, choose the first column you want to sort under the Sort by drop-down menu and specify the sorting order

Excel allows you to sort data in more ways than just alphabetically. You can also sort by color, by cell icon, or even by a custom list you’ve created.

For instance, if you have a column that uses cell color to indicate priority levels, you can sort your data based on those colors.

Simply go to the “Sort” dialog box, select the column, and then choose “Sort by Color” from the “Sort On” drop-down.

We’ve covered how to sort by more than one column, but you can also sort by more than one criterion within a single column.

For example, you might want to sort a column of text by cell color first and then alphabetically.

This can be done by adding two sort levels for the same column, each with a different “Sort On” criterion.

The SORT function in Excel can help you sort data based on multiple columns. Here is an example:

=SORT(range, [sort_index1], [sort_order1], [sort_index2], [sort_order2], ...)

In this formula, you have to specify the following:

The data range

Columns to sort by (index)

Sort order (1 for ascending, -1 for descending)

You can add more columns to sort by adding more sort_index and sort_order pairs to the SORT function.

Data with merged cells can be tricky to sort. When you try to sort a range that includes merged cells, Excel will give you an error message.

But don’t panic, there’s a workaround.

You’ll need to unmerge all the cells, sort the data, and then reapply the merging. Just make sure to copy the merged cell’s value to all of the unmerged cells before sorting.

Next, we’ll troubleshoot some common issues you might run into when sorting Excel columns.

Even though Excel is a powerful tool, it’s not without its quirks. You might run into a few bumps along the road while sorting but don’t fret. We’re here to help you troubleshoot some of the most common issues.

Sometimes your data won’t sort correctly because it isn’t stored in the correct format. For instance, if numbers are stored as text, they might not sort numerically.

To apply a common cell format to your data, press Ctrl+1, go to the Number tab, and select the suitable format under “Category.”

If your data isn’t sorting as expected, check for extra spaces at the start or end of your cells. Excel includes these spaces in its sorting, which might throw off your results.

You can remove extra spaces using Excel’s TRIM function by typing “=TRIM(A1)” in a new cell (if A1 is the cell containing the leading space) and then copy the result to the original cell.

Also, make sure that there are no unexpected blank rows or cells in your dataset. Blank cells can affect your sorting process. If you find any blank cells, you can either delete the entire row or fill it with the correct data.

Before sorting your data, it’s a good idea to remove duplicate rows. This ensures that your sorted data is accurate and representative. Follow these steps to remove duplicates:

Excel will remove any duplicate rows and shows a message that how many duplicate rows were removed.

If Excel crashes or hangs during sorting, your worksheet might be too large, or your computer might not have enough resources. Try closing other applications to free up memory.

If your worksheet is large, consider breaking it down into smaller, more manageable chunks.

Remember, sorting can be a complex process, especially with large datasets. If you run into trouble, take a step back and try to troubleshoot one issue at a time. You’ve got this!

Now that you’ve gotten a handle on sorting in Excel, how about we sprinkle in a little extra magic?

To help you become an even more efficient data maestro, we’re going to share some additional tips and tricks that can make your sorting tasks quicker, smoother, and generally more awesome.

Keyboard shortcuts can save you time and enhance your productivity when working with Excel data. Here are a few shortcuts for sorting alphabetically:

Alt + A + S + A: Sort the selected data alphabetically from A to Z.

Alt + A + S + D: Sort the selected data alphabetically from Z to A.

Alt + D + S: Open the Sort dialog box to apply custom sorting.

Remember to select the desired data range or cell in the same row or column before using these keyboard shortcuts. Otherwise, you will get the wrong results.

Excel allows you to save your custom sort settings to reuse them later. Follow these steps to save your sorting options:

Step 1: Select your data range or the cells within the column you want to sort

Step 3: In the “Sort” dialog box, select the column name from the Sort by drop-down. Note that if there are no column headers, Excel is showing column letters.

Now your custom sort settings are saved, and you can see them in the Custom Lists section of the Order drop-down menu in the Sort dialog box for future use.

But remember, this is just the beginning. Excel is an incredibly powerful tool, with countless more features and functionalities waiting to be discovered.

This guide should have armed you with the skills and knowledge to tackle data sorting in Excel like a pro. But don’t stop here. The real magic happens when you take these lessons and apply them to your own work.

To learn more Excel tricks, check out the video below:

How To Insert And Retrieve Dates In Oracle

Problem:

You want to insert dates into a table and retrieve them.

Solution

Oracle, by default the uses the format DD-MON-YYYY to represent a date, where

DD represents a two-digit day.

MON represents first three letters of the month, e.g., FEB.

YYYY is a four-digit year, e.g., 1968

Let us take a look at an example of adding a row to the customers table, which contains a DATE column named dob.

The following INSERT adds a row to the customers table, setting the dob column to 05-FEB-1968:

Example

INSERT INTO customers ( customer_id, first_name, last_name, dob, phone) VALUES (7, 'James', 'Bond', '31-DEC-2000', '007-007-0007');

You can also use the DATE keyword to supply a date literal to the database. The date must use the date format YYYY-MM-DD, where

YYYY is a four-digit year.

MM is a two-digit month from 1 to 12.

DD is a two-digit day.

Example

INSERT INTO customers ( customer_id, first_name, last_name, dob, phone) VALUES (11, 'Roger', 'Federer', DATE '1983-10-01', '001-001-0001');

By default, the database returns dates in the format DD-MON-YY, where YY are the last two digits of the year.

CONVERTING DATETIMES USING TO_CHAR() AND TO_DATE()

The Oracle database has functions that enable you to convert a value in one data type to chúng tôi will use the TO_CHAR() and TO_DATE() functions to convert a datetime to a string and vice versa.

TO_CHAR() to Convert a Datetime to a String

TO_CHAR(x [, format]) to convert the datetime x to a string. We can also provide an optional format for x. An example format is MONTH DD, YYYY, where

MONTH is the full name of the month in uppercase.

DD is the two-digit day.

YYYY is the four-digit year.

The following query uses TO_CHAR() to convert the dob column from the customers table to a string with the format MONTH DD, YYYY

Example

SELECT customer_id, TO_CHAR(dob, 'MONTH DD, YYYY') FROM customers;

The next query gets the current date and time from the database using the SYSDATE function, then converts the date and time to a string using TO_CHAR() with the format MONTH DD, YYYY, HH24:MI:SS. The time portion of this format indicates that the hours are in 24-hour format and that the minutes and seconds are also to be included in the string.

Example

SELECT TO_CHAR(SYSDATE, 'MONTH DD, YYYY, HH24:MI:SS') FROM dual;

NOVEMBER  13, 2023, 10:04:11

TO_DATE() to Convert a String to a Datetime

We can use TO_DATE(x [, format]) to convert the x string to a datetime. We can provide an optional format string to indicate the format of x. If we omit format, the date must be in the default database format (usually DD-MON-YYYY or DD-MON-YY).

The following query uses TO_DATE() to convert the strings “31-DEC-2024” and “31-DEC-20” to the date December 31, 2023. However, the final date is displayed in the default format of DD-MON-YY.

Example

SELECT TO_DATE('31-DEC-2024'), TO_DATE('31-DEC-20') FROM dual;

Finally, a DBA can help you set the default date format in Oracle.

A DBA can change the setting of NLS_DATE_FORMAT by setting this parameter’s value in the database’s chúng tôi or chúng tôi file, both of which are read when the database is started. A DBA can also set NLS_DATE_FORMAT using the ALTER SYSTEM command. You can also set the NLS_DATE_FORMAT parameter for your own session using SQL*Plus, which you do by using the ALTER SESSION command

Example

ALTER SESSION SET NLS_DATE_FORMAT = 'MONTH-DD-YYYY';

How To Use Vlookup In Excel

The VLOOKUP function in Excel scares a lot of people because it has a lot of parameters and there are multiple ways to use it. In this article you’ll learn all of the ways you can use VLOOKUP in Excel and why the function is so powerful.

Table of Contents

VLOOKUP Parameters In Excel

When you start typing =VLOOKUP( into any cell in Excel, you’ll see a pop-up showing all of the available function parameters.

Let’s examine each of these parameters and what they mean.

These four parameters let you do a lot of different, useful searches for data inside of very large datasets.

A Simple VLOOKUP Excel Example

VLOOKUP isn’t one of the basic Excel functions you might have learned, so let’s look at a simple example to get started.

It would be very time consuming to search through such a large dataset to find the school that you’re interested in.

Instead, you can create a simple form in the blank cells on the side of the table. To conduct this search, just make one field for School, and three additional fields for reading, math, and writing scores.

Next, you’ll need to use the VLOOKUP function in Excel to make these three fields work. In the Reading field, create the VLOOKUP function as follows:

Type =VLOOKUP(

Select the School field, which in this example is I2. Type a comma.

Select the entire range of cells that contain the data you want to look up. Type a comma.

When you select the range, you can start from the column you’re using to look up (in this case the school name column), and then select all of the other columns and rows that contain the data.

Note: The VLOOKUP function in Excel can only search through cells to the right of the search column. In this example, the school name column needs to be to the left of the data you’re looking up.

Next, to retrieve the Reading score, you’ll need to select the 3rd column from the leftmost selected column. So, type a 3 and then type another comma.

Finally, type FALSE for an exact match, and close the function with a ).

Your final VLOOKUP function should look something like this:

=VLOOKUP(I2,B2:G461,3,FALSE)

When you first press Enter and finish the function, you’ll notice the Reading field will contain an #N/A.

This is because the School field is blank and there is nothing for the VLOOKUP function to find. However, if you enter the name of any high school you want to look up, you’ll see the correct results from that row for the Reading score.

How To Deal With VLOOKUP Being Case- Sensitive

You may notice that if you don’t type the name of the school in the same case as how it’s listed in the dataset, you will not see any results.

This is because the VLOOKUP function is case sensitive. This can be annoying, especially for a very large dataset where the column you’re searching through is inconsistent with how things are capitalized.

To get around this, you can force what you’re searching for to switch to lowercase before looking up the results. To do this, create a new column next to the column you’re searching. Type the function:

=TRIM(LOWER(B2))

This will lowercase the school name and remove any extraneous characters (spaces) that might be on the left or right side of the name.

Now that all of your data is cleaned up in this new column, slightly modify your VLOOKUP function in Excel to use this new column instead of the previous one by starting the lookup range at C2 instead of B2.

=VLOOKUP(I2,C2:G461,3,FALSE)

Now you’ll notice that if you always type your search in lower case, you’ll always get a good search result.

This is a handy Excel tip to overcome the fact that VLOOKUP is case sensitive.

VLOOKUP Approximate Match

While the exact match LOOKUP example described in the first section of this article is pretty straightforward, the approximate match is a little more complex.

The approximate match is best used to search through number ranges. To do this correctly the search range needs to be properly sorted. The best example of this is a VLOOKUP function to search for a letter grade that corresponds to a number grade.

If a teacher has a long list of student homework grades from throughout the year with a final averaged column, it would be nice to have the letter grade corresponding to that final grade come up automatically.

This is possible with the VLOOKUP function. All that’s required is a lookup table off to the right that contains the appropriate letter grade for each numerical score range.

Now, using the VLOOKUP function and an approximate match, you can find the proper letter grade corresponding to the correct numeric range.

In this VLOOKUP function:

lookup_value: F2, the final averaged grade

table_array: I2:J8, The letter grade lookup range

index_column: 2, the second column in the lookup table

[range_lookup]: TRUE, approximate match

Once you finish the VLOOKUP function in G2 and press Enter, you can fill in the rest of the cells using the same approach described in the last section. You’ll see all of the letter grades properly filled in.

Note that the VLOOKUP function in Excel searches from the bottom end of the grade range with the assigned letter score to the top of the range of the next letter score.

So, “C” needs to be the letter assigned to the lower range (75), and B is assigned to the bottom (minimum) of its own letter range. VLOOKUP will “find” the result for 60 (D) as the closest approximate value for anything between 60 to 75.

VLOOKUP in Excel is a very powerful function that has been available for a long time. It is also useful for finding matching values anywhere in an Excel workbook.

Keep in mind, however, that Microsoft users who have a monthly Office 365 subscription now have access to a newer XLOOKUP function. This function has more parameters and additional flexibility. Users with a semi-annual subscription will need to wait for the update to roll out in July 2023.

How To Update Listview After Insert Values In Android Sqlite?

   android:layout_width = “match_parent”    android:layout_height = “match_parent”    tools:context = “.MainActivity”    <EditText       android:id = “@+id/name”       android:layout_width = “match_parent”       android:hint = “Enter Name”    <EditText       android:id = “@+id/salary”       android:layout_width = “match_parent”       android:inputType = “numberDecimal”       android:hint = “Enter Salary”    <LinearLayout       android:layout_width = “wrap_content”       android:id = “@+id/save”       android:text = “Save”       android:layout_width = “wrap_content”    <Button       android:id = “@+id/refresh”       android:text = “Refresh”       android:layout_width = “wrap_content”    <ListView       android:id = “@+id/listView”       android:layout_width = “match_parent” import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.EditText; import android.widget.ListView; import android.widget.Toast; import java.util.ArrayList; public class MainActivity extends AppCompatActivity {    Button save, refresh;    EditText name, salary;    private ListView listView;    @Override    protected void onCreate(Bundle readdInstanceState) {       super.onCreate(readdInstanceState);       setContentView(R.layout.activity_main);       final DatabaseHelper helper = new DatabaseHelper(this);       final ArrayList array_list = helper.getAllCotacts();       name = findViewById(R.id.name);       salary = findViewById(R.id.salary);       listView = findViewById(R.id.listView);       final ArrayAdapter arrayAdapter = new ArrayAdapter(MainActivity.this,      android.R.layout.simple_list_item_1, array_list);       listView.setAdapter(arrayAdapter);          @Override             array_list.clear();             array_list.addAll(helper.getAllCotacts());             arrayAdapter.notifyDataSetChanged();             listView.invalidateViews();             listView.refreshDrawableState();          }       });          @Override             if (!name.getText().toString().isEmpty() && !salary.getText().toString().isEmpty()) {                if (helper.insert(name.getText().toString(), salary.getText().toString())) {                   Toast.makeText(MainActivity.this, “Inserted”, Toast.LENGTH_LONG).show();                } else {                   Toast.makeText(MainActivity.this, “NOT Inserted”, Toast.LENGTH_LONG).show();                }             } else {                name.setError(“Enter NAME”);                salary.setError(“Enter Salary”);             }          }       });    } }

Step 4 − Add the following code to src/ DatabaseHelper.java

package com.example.andy.myapplication; import android.content.ContentValues; import android.content.Context; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteException; import android.database.sqlite.SQLiteOpenHelper; import java.io.IOException; import java.util.ArrayList; class DatabaseHelper extends SQLiteOpenHelper {    public static final String DATABASE_NAME = "salaryDatabase3";    public static final String CONTACTS_TABLE_NAME = "SalaryDetails";    public DatabaseHelper(Context context) {       super(context,DATABASE_NAME,null,1);    }    @Override    public void onCreate(SQLiteDatabase db) {       try {          db.execSQL(             "create table "+ CONTACTS_TABLE_NAME +"(id INTEGER PRIMARY KEY, name text,salary text )"          );       } catch (SQLiteException e) {          try {             throw new IOException(e);          } catch (IOException e1) {             e1.printStackTrace();          }       }    }    @Override    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {       db.execSQL("DROP TABLE IF EXISTS "+CONTACTS_TABLE_NAME);       onCreate(db);    }    public boolean insert(String s, String s1) {       SQLiteDatabase db = this.getWritableDatabase();       ContentValues contentValues = new ContentValues();       contentValues.put("name", s);       contentValues.put("salary", s1);       db.insert(CONTACTS_TABLE_NAME, null, contentValues);       return true;    }    public ArrayList getAllCotacts() {       SQLiteDatabase db = this.getReadableDatabase();       Cursor res = db.rawQuery( "select * from "+CONTACTS_TABLE_NAME, null );       res.moveToFirst();       while(res.isAfterLast() = = false) {          array_list.add(res.getString(res.getColumnIndex("name")));          res.moveToNext();       }       return array_list;    }

Update the detailed information about How To Insert Multiple Rows In Excel on the Kientrucdochoi.com website. We hope the article's content will meet your needs, and we will regularly update the information to provide you with the fastest and most accurate information. Have a great day!