is there a way to give column names to pd.read_clipboard() as it is treating first row of data as column names - pandas

I am using pd.read_clipboard() function to get an excel table that doesnt have column names as first row . The dataframe returned has first row as column labels. How to fix that.
I would like results to be
and not this

Though not showing up on help for read_clipboard() function , passing read_clipboard(names=['c1','c2']) where c1 and c2 are the column names fixes the read_clipboard() function to not treat first row as column names i.e provide column names to avoid having the function treat first row as column names

Related

Find number of rows in an already filtered Column A in Excel

I have got an Excel spreadsheet. This spreadsheet has just one tab in it. The Tab name is dynamic in nature and changes every week also the number of rows.
I have column A filtered already with a VBA macro. A1 has the header.
Now, I wanna find how many rows are there in this already filtered column A.
I am looking for any VBA function.
I have tried using Subtotal function.
=Subtotal(103,A2:A1345)
But I don't know the end range. As of now the end range is A1345. It will change every time in future if the new rows are added.
I tried multiple things but those did not work. I am quite new to VBA.
If A1 will never be blank, you could use (in a column other than A)
=Subtotal(103,A:A)-1.
Or, if there will be data below your table not to be counted, then format your table as a Table and use structured references (and this formula could go into column A)
=SUBTOTAL(103,Table1[column_header])
You can put the formula in column A if you use another column's last populated cell as the demarcation point.
If column B contains numbers then,
=subtotal(103, a2:index(a:a, match(1e99, b:b)))
If column B contains text then,
=subtotal(103, a2:index(a:a, match("zzz", b:b)))

VLOOKUP to return multiple matches

I want to ask if there's a way/formula/vba to return multiple values when using vlookup? For example, I vlookup a data and when that data has multiple values to return, it will return the other values. Thanks.
For something as generic as this, just use Google.
Step #1) www.google.com
Step #2) get your answer in less time than it takes you to post here.
Return MULTIPLE corresponding values for ONE Lookup Value
The Excel VLOOKUP Function searches for a value (ie. Lookup_value) in the first column of a table array and returns a value in the same row from another column in the table array. In case of multiple occurrences of the Lookup value, the function searches the first occurrence of the Lookup value, and returns the corresponding value in the same row from another column.
In case you want to return multiple corresponding values, for the one Lookup value which has multiple occurrences, we show how it can be done using INDEX, SMALL, IF & ROW excel functions, as follows.
Consider the table array ("A2:B8"), in which you want to lookup the value "Apples" in column A which has multiple occurrences, and return all corresponding values in column B.
Enter the lookup value "Apples" in cell A11. In cell B11, enter below formula, as an array formula (CTRL+SHIFT+ENTER), and copy it downward in the same column B, in 7 rows (ie. number of times as the number of records in the table array "A2:B8". Multiple corresponding values (of the lookup value "Apples") will get copied vertically, starting from cell B11 till B17. Refer Table 1.
=INDEX($B$2:$B$8, SMALL(IF($A$11=$A$2:$A$8, ROW($A$2:$A$8)-ROW($A$2)+1), ROW(1:1)))
http://www.globaliconnect.com/excel/index.php?option=com_content&view=article&id=119:vlookup-multiple-values-return-multiple-corresponding-values-for-one-lookup-value&catid=77&Itemid=473

Adding a row between cell with the same value using VBA code

Im new in VBA and want to know how can i format my table in such a way that each name in Column one do only have 1 row in between.
Some of them do have more than 1 row in between and some of them doesn't have. I just need to format then in such a way where every name on column A has 1 blank row in between. Any help would be appreciated!
Please note that i have thousands of data so manual will not work.
also i tried doing the filtering and convert them into single block. the problem with single block is that my column c do have more than 1 information which is connected to column a, .
here is an example.enter image description here

How to combine INDEX, IFERROR and VLOOKUP formulas

I would like to Index a columns info, run a vlookup of a particular text(s) and then perform an if error to ignore things not like the "lookup value". I have data in column V called "Biscuits" amongst other items of different names. "Biscuits" has to be replaced with a different name. But the name change will not be the same for each occurrence. I would like to maintain the original column V's data and Index that particular columns values into another column. Once I have created a "copy" of the original data named column AV, I then need to run a vlookup on column AV. I have a column AW that has manual information of different names inputted in this column. In the "Indexed" Column AV I would like to run vlookup on "Biscuits" ONLY, skipping other entries and replace "Biscuits" with the contents of column AW (all entries in Column AW for name changes are on the same lines as "Biscuits"
Example
Original Column, Indexed Column, Manual input column and final result
=INDEX(V2, ,)-this is the formula I wrote to Index column V, thus creating column AV
=IFERROR(VLOOKUP("Biscuits",V2:AW2,28,FALSE),"")-This is a formula I wrote to look for "Biscuits" and replace it with the contents of column AW
Please help on this.
Thank you!
According to OP It worked!, the formula being:
=IF(AW2="",V2,AW2)
Ie return the contents of V2 if AW2 is empty and the contents of AW2 otherwise. This can be copied down to apply to other rows, with references adjusting automatically. Neither the 'index column' nor any of INDEX, IFERROR or VLOOKUP were required.

Excel 2007 - Compare 2 columns, find matching values

I have two colums. Column A and Column B which have email addresses. Column A has about 3000 rows, Column B has about 1800. Is there anyway to compare the two columns, and find any fields that match...
And if so, how to either highlight or flag them as a match... or shit, for even simplicitys sake, just give me a count of how many matches were found...
Should i try a macro? Or is there a forumula that will help with this?
You could fill the C Column with variations on the following formula:
=IF(ISERROR(MATCH(A1,$B:$B,0)),"",A1)
Then C would only contain values that were in A and C.
=VLOOKUP(lookup_value,table_array,col_index_num,range_lookup) will solve this issue.
This will search for a value in the first column to the left and return the value in the same row from a specific column.
VLOOKUP deosnt work for String literals