Export Access Query to Excel and add empty cells - excel

I need to export an Access query into an Excel spreadsheet and add blank cells. My data from the Access query looks like this:
1018
522
347
449
271
221
7
6
238
90
185
34
117
144
But I will need it to look like this in Excel:
1018
522
347
449
271
221
And so on. I've done doCmd.TransferSpreadsheet but it doesn't allow for exporting ranges. Other examples I've seen that involve more VBA, don't go into formatting in that way. Any ideas where I should look? Thanks.

I don't have much time, so hope this makes sense:
Make a make-table-query, that takes your source query, adds autonumber, and a field called Place= autonumber * 10, and creates a table called tblNew.
1018 will have Place=1 * 10 = 10
522 will have Place= 2 * 10 = 20
347 will have Place=3 * 10 = 30
etc.
Make a select query, qryBlank, that makes a blank line for each record with Place=20,40,60 etc. in tblNew. Each blank line must have Place = 20 +1, 40+1, 60+1 etc.
Make a union query between tblNew and qryBlank.
Now you have one line between the pairs. You can just add more queries like qryBlank to make more lines.
Make a make-table query, that selects * from the union query, orders by the field Place, and creates a new table.
Link to the new table in Excel.

Related

How do I find the largest numbers in a area, and then find the value of a number in the same row?

I cannot find a way to do this, is it possible (with excel functions or VBS)?
For example, these would be the initial values:
Number
Value
101
234
102
324
103
345
104
325
105
437
106
443
107
806
108
476
109
538
110
546
And after taking the three highest numbers, this would be the output:
Number
Value
107
806
110
546
109
538
The data is constantly updating, so that might cause some issues.
You can use FILTER in combination with LARGE function to achieve this:
Columns A and B represent sample data. Cell D2 can contain this formula:
=FILTER($A$2:$B$9,$B$2:$B$9>=LARGE($B$2:$B$9,3))
If data is constantly updating, better to have an Excel Table (I named TB_NumVal), so the range index get automatically updated.
In cell: J2:
=SORT(FILTER(SORT(TB_NumVal,2), (ROW(TB_NumVal[Number])-1)
> ROWS(TB_NumVal[Number])-3),2,-1)
Here is the output:
Explanation
We sort the data, then since we start on row 2 (row 1 is the header) we substract 1. So
ROW(TB_NumVal[Number])-1
will provide the row number starting from one.
ROWS(TB_NumVal[Number])
is the total number of rows, in our case 10.
Using a filter condition like this:
(ROW(TB_NumVal[Number])-1) > ROWS(TB_NumVal[Number])-3)
ensures only the last three row will be selected, then finally sorted the filtered result by value in descending order to match the result of the screenshot of the question.

How to compare 2 massive/huge/long lists and output any non matching results in one field

I have 2 massive columns filled with studentids
Column 1(SID) has 110,000 rows
Column 2(SID2) has 100,000 rows
How do I make a check of column 1 = column 2 or vice versa and then finally place it all in one field!
Current Results
SID SID2
45 45
142 142
237 218
238 441
410 410
440 442
452 237
452
Final Expected output
SID SID2 Check
45 45
142 142
237 218
238 441 238,441
410 410
440 442 440
452 237
452
238,441,440
As you can see, all the ids that dont match should be placed in one field so I can easily spot them rathen than looking though 100,000 rows
Looks like SolarMike answered assuming that the test is A2=B2, but I think you're asking if A2=[Anything in Column B] and if B2=[Anything in Column A]. Here's how I'd test that:
Column C:
=IFERROR(IF(MATCH(A2,B:B,0)>1,"",A2),A2)
Column D:
=IFERROR(IF(MATCH(B2,A:A,0)>1,"",B2),B2)
Column E (very crude, but effective):
=IF(AND(C2="",D2=""),"",CONCATENATE(C2,",",D2,","))
Now, your real problem is getting it all into one single cell. The only way I know how to do this is to use Concatenate, but it requires you to select EACH CELL individually.
=CONCATENATE(E2,E3,E4,E5,E6,E7,E8,E9,E10)
For 10000 rows, that doesn't seem feasible. Also, that output isn't very flexible, but I digress.
If you want to concatenate everything together in one cell, you have two options.
A) Use the VBA code here (it's pretty simple, this seems like a viable option): Concatenate Excel Ranges with VBA
B) Hope that you have Office 365 with TEXTJOIN() See Support article here.
You could use match() with iferror() and if():
=IF(IFERROR(MATCH(A1,B1,)>0,0),"ok",A1)
see:
To get both fields back use:
=IF(IFERROR(MATCH(A1,B1,)>0,0),"ok",A1)&" , "&IF(IFERROR(MATCH(A1,B1,)>0,0),"ok",B1)

How can I merge rows in Excel 2010?

My Excel sheet contains columns for id, date, amount and name.
If two or more rows have the same id and name I want to merge them into one row with the amount of those two combined. Can anybody help me doing this?
Use concatenation with Columns ID and NAME (=ID&NAME) in another column and look for the pivot table. Move to Insert->Pivot table option to get the attached answer]
Hope this clarifies
Here is a possible solution (as far as I understand the problem) using a PivotTable:
As you can see, there is not really much to it. Just insert a pivot table and drag the ID & Name to the Rows while you move the dates and the values to the Values section of the pivot table. The Values in the Column section will be automatically generated.
The only thing I changed at the end was to format the pivot table nicely doing the following:
Remove SubTotals by name
Using a PivotTable style that I like from the PivotTable menu in the section Design.
Show items in a tabular format. That means that the name and the ID are shown on one row and not in a cascading format (ID in one row and the name in a second row underneath + indented). You can achieve this by right-clicking on the name and selecting Field Settings. A new window opens (showing the settings). Go here to the Layout & Print tab and select Show item labels in a tabular form. You might have to repeat that for the field Name and the field ID (depending on which of the two fields you chose to show first in the Rows section of the PivotTable).
Let me know if this solved your problem or if you have any questions.
Note: since no sample data has been provided I made some up. I sure hope this data is somewhat similar to what you are trying to aggregate.
Used sample data:
ID Date Amount Name
1 05.03.2015 121 Peter
2 14.01.2015 127 Max
3 11.01.2015 77 Eva
4 06.11.2015 141 Jamie
5 04.03.2015 58 Sophie
1 04.04.2015 94 Peter
7 20.06.2015 52 Lucas
3 14.12.2015 136 Eva
2 02.11.2015 93 Max
10 20.08.2015 59 Mason
4 11.01.2015 145 Jamie
4 02.02.2015 113 Jamie
4 26.02.2016 89 Jamie
1 30.03.2016 137 Peter
15 09.09.2015 81 Jackson
16 25.02.2015 61 Liam
2 26.02.2016 133 Max
2 26.10.2015 80 Max
19 25.09.2015 76 Aiden

Rounding in Excel Formula using complex conditions

Hi I need to round up the numbers (last 2 digits, no decimal) based on following conditions:
If from 0 to 64 should be 49
If from 65 – 89 set at 79
If from 90 – 129 set at 99
If from 130 – 164 set at 149
If from 165 – 189 set at 179
If from 190 – 229 set at 199
and so on until 989
Then:
If value is from 989 – 1099 set at 999
If value is from from 1100 – 1249 set at 1199
If value is from from 1250 – 1349 set at 1299
If value is from from 1350 – 1449 set at 1399
and so on until 5000
I would appreciate some info and help how to get a formula to work for this.
Thanks
Harmz
This is not really a rounding problem but more a conversion problem. because there seems to be no pattern to your number groups I don't think it is therefore something you can calculate and therefore you will have to do a lookup.
If you want to do it all in one formula you could use and array inside of a vlookup like the partial example below:
=VLOOKUP(C1,{0,49;65,79;90,99;130,149;165,179},2,TRUE)
Otherwise do it as a normal vlookup. All you need is a two column table table, the first column contains the lower bound of you ranges and the second column contains the value that you want it to be. The important thing is that the vlookup has the final parameter of true, this makes the vlookup find the nearest match.

Excel simple formula to work only on filtered results

I have a set of data with over 1000 entries.
I can filter these using the auto filter.
At the bottom, I then have some simple formulas, for example AVERAGE() and QUARTILE().
What I would like to achieve is that when I filter the data, the results from AVERAGE should change, so they should only take into account the visible data.
I've been searching google and here, but can't seem to find anything like this, other than using "subtotal", but that's not for the formulas I want to use.
Is this possible?
Thanks,
Use SUBTOTAL
Function_num Function_num Function
(incl hidden) (ignores hidden)
1 101 AVERAGE
2 102 COUNT
3 103 COUNTA
4 104 MAX
5 105 MIN
6 106 PRODUCT
7 107 STDEV
8 108 STDEVP
9 109 SUM
10 110 VAR
11 111 VARP
So you could use :
=SUBTOTAL(101, yourRange)
I think you should use a pivot table.

Resources