I would like to extract: 1 High Street in column B1 and Sydney NSW in column C1. So far I have extracted column B1 correctly using =TRIM(MID(SUBSTITUTE($A1," ",REPT(" ",99),3),(COLUMNS($A:A)-1)*99+1,99)) but when I try to extract C1 using =TRIM(MID(SUBSTITUTE($A1," ",REPT(" ",99),3),(COLUMNS($A:B)-1)*99+1,99)) I get Sydney NSW 2000 I need it to return only Sydney NSW and omit the 2000. Thanks
Related
Currently I have a excel table that looks like this
A B C D E F G
ID NAME DATE ITEM 2020 3
1234 Alex 09-20-2020 Carrot 2019 2
1234 Alex 09-20-2020 Onion
1234 Alex 09-20-2019 Carrot
1234 Alex 09-20-2019 Mushroom
1234 Alex 09-20-2020 Pasta
1345 Morgan 09-20-2020 Pasta
1345 Morgan 09-20-2020 Tomato Sauce
1145 Jayson 09-20-2020 Tomato Sauce
1145 Jayson 09-20-2020 Cream Sauce
1345 Morgan 09-20-2019 Pasta
1345 Morgan 09-20-2019 Tomato Sauce
I want to be able to count the unique customers for each year using excel functions. This is so that the functions can be transferred to a different computers without setting up the custom functions.
The proccess currently can be done in excel without function by: adding filter to each column, filtering to only show the intended year, using remove duplicate to remove duplicates in NAME, and finally counting the rows (giving reslts seen in G2 & G3). However, I want to be able to do that through excel functions. So far what I have is that I am able to count unique values through
{=SUM(IF(FREQUENCY(IF(LEN(B2:B12)>0,MATCH(B2:B12,B2:B12,0),""),IF(LEN(B2:B12)>0,MATCH(B2:B12,B2:B12,0),''))>0,1))}
Additionally I am also able to SUMPRODUCT() for counting a array with multiple condition so for now I have combined the above forumla with
SUMPRODUCT((YEAR(C2:C12)=G1)+0)
My initial idea was to add the first function into the SUMPRODUCTI() since the first function could also produce a array that it could count. However that quickly did not work as it did not count the unique values corresponding to the year.
My question here is if there is any way to what would be a grouping function so that I can take unique values that are within a year, without transforming the data (through filters of deletion of duplicates). My current understanding with SUMPRODUCT() is that it will only look for unique values in the entire column but not within the range given for the first array.
You have got numeric ID's which you should make use of. If you have got Excel O365, in G1 use:
=COUNT(UNQIUE(FILTER(A$2:A$12,YEAR(C$2:C$12)=F1)))
With older versions, use this CSE-entered formula:
=SUM(--(FREQUENCY(IF(YEAR(C$2:C$12)=F1,A$2:A$12),A$2:A$12)>0))
And drag down.
Not sure I am saying this right but I need to build a list of statements based on a number in a cell. For example, in column A I have a list of room types: Office, Bathroom, Reception, Lobby, etc. and in column B I have the number of those room types in the building.
| COL A | | COL B |
Office 5
Bathroom 3
Reception 1
Lobby 2
For Office, I put 5 in column B - Bathroom I have 3 in B, and so on.
Now what I need is a way to read the number of Offices and build a statement like:
Office 001
Office 002
Office 003
Office 004
Office 005
Of course if I had put 6, then I would see Office 006. I am not worried about getting all of the variable names into one column as each room type will then have it's own set of questions that I will figure out later.
Right now I am using messy IF statements and dragging them down the sheet.
try:
=ARRAYFORMULA(
TRANSPOSE(SPLIT(CONCATENATE(REPT(A:A&"♦", B:B)), "♦"))&TEXT(COUNTIFS(
TRANSPOSE(SPLIT(CONCATENATE(REPT(A:A&"♦", B:B)), "♦")),
TRANSPOSE(SPLIT(CONCATENATE(REPT(A:A&"♦", B:B)), "♦")),
ROW(INDIRECT("A1:A"&SUM(B:B))), "<="&
ROW(INDIRECT("A1:A"&SUM(B:B)))), " 000"))
I have two sheets: one is input and the other is master.
A snapshot of my input sheet is shown below:
Workers Name WEEK working hrs
a11 w1 40
a22 w5 30
a33 w9 10
a44 w10 80
A snapshot of my master sheet is shown below (NB: the workers names are unique)
Workers Name W1 W2 W3 W4 W5 W6 W7 W8 W9 W10
a11 40
a22 30
a33 10
a44 80
I want a sumifs loop so that it can give result for workers working hrs in my masters table in their respective weeks(w1 to w13).
I am using a sum ifs formula for this:
Sheets("Master").Range("B2:B" & Range("A" & Rows.Count).End(xlUp).Row).Formula = "=SUMIFS(Input!C32,Input!C37,Master!C1,Input!C31,Master!B1)"
Any suggestions how to loop it in VBA
Please help....
I'm sorry but I'm not sure you need vba - if you know what your row and column criteria are in master you can write something like
=sumifs(workinghrs,workersname,$a2,week,b$2)
Then fill it down and across for your grid.
NB I've used named ranges for your input sheet for readability
I have one column (call it A) of data where each cell contains a long string of words e.g.:
COLUMN A
HORNBACH BAUMARKT ETOY, ETOY
ALIGRO, CHAVANNES-PR
DIPL. ING. FUST AG,ETO, ETOY
AGIP SUISSE SA 224, LAUSANNE
AMAZON MEDIA EU, LUXEMBOURG
MIGROS M EPALINGES, EPALINGES
HORNBACH BAUMARKT ETOY, ETOY
MANOR AG - 390, BASEL
MANOR AG - 390, BASEL
GLOBUS LAUSANNE, LAUSANNE
I also have another list of keywords in another column (call it B) e.g.
COLUMN B
MSFT
Amazon
Hornbach
Jumbo
OBI
Lipo
Ikea
Coop
Migros
Casino
This is what I would like to do:
For each keyword K in Col B
Check each cell in Col A to see if the entry exists as a sub-string
If it does, then enter the keyword K in an adjacent cell in Column C
If not, then leave the adjacent cell in Column C untouched
Repeat for next keyword K
The result should be:
COLUMN A ----------------------------------> COLUMN C
HORNBACH BAUMARKT ETOY, ETOY --------------> Hornbach
ALIGRO, CHAVANNES-PR
DIPL. ING. FUST AG,ETO, ETOY
AGIP SUISSE SA 224, LAUSANNE
AMAZON MEDIA EU, LUXEMBOURG ---------------> Amazon
MIGROS M EPALINGES, EPALINGES -------------> Migros
HORNBACH BAUMARKT ETOY, ETOY --------------> Hornbach
MANOR AG - 390, BASEL
MANOR AG - 390, BASEL
GLOBUS LAUSANNE, LAUSANNE
I can see how to do this using VBA type structures... but surely there must be a way to do this using built in Excel functions - INDEX, HLOOKUP, SEARCH... etc.
I've tried but not succeeded. If anyone has a better idea, please let me know.
Assuming only 1 matching word per row at most you could use this formula in C1 copied down
=IFERROR(LOOKUP(2^15,SEARCH(B$1:B$10,A1),B$1:B$10),"")
IFERROR function is available in Excel 2007 or later versions only, for earlier Excel versions try this modification
=LOOKUP("zzz",IF({1,0},"",LOOKUP(2^15,SEARCH(B$1:B$10,A1),B$1:B$10)))
If you want to get multiple matches, in separate cells then you can use this "array formula" in C1, confirmed with CTRL+SHIFT+ENTER and copied down and across as far as you might need (commensurate with the maximum possible matches)
=IFERROR(INDEX($B$1:$B$10,SMALL(IF(COUNTIF($A1,"*"&$B$1:$B$10&"*"),ROW($B$1:$B$10)-ROW($B$1)+1),COLUMNS($C1:C1))),"")
If A1 contains 3 words on the list then those will be populated in C1, D1 and E1 and F1 etc. will remain blank
Revised as per comments:
The first range in the formula (first argument of INDEX), defines the range from which the result is taken so to change that to column Z just change that part, i.e.
=IFERROR(INDEX($Z$1:$Z$10,SMALL(IF(COUNTIF($A1,"*"&$B$1:$B$10&"*"),ROW($B$1:$B$10)-ROW($B$1)+1),COLUMNS($C1:C1))),"")
*I'd like to ask that you please do not just say "add a column to your data that..."
*I want to know if the pivot table itself can do this.
My data comes from a sql query. The query is inserted into excel via the Data->From Other Sources path. So, going in to edit the query within excel, or open the query itself, editing, and repasting is not ideal, especially when the excel file needs to be distributed.
My raw data is set-up like this. I've put zeros in for blanks, but my flags are either 1 or blank (empty cell)
id costa costb names ... ... flagA flagB flagC
1 1000 2000 apple ... ... 1 1 1
2 2300 1200 brake ... ... 1 0 1
3 4600 3400 candy ... ... 0 1 1
4 6900 4300 drill ... ... 1 0 0
I want my pivot table to COUNT occurence of items that are flagb and flagc.
Usually with only one flag. Your calculated field will be a SUM with formula ='flagb'
How can I make the field bebased on two flags, not just one?
Again. I don't want to add a new column to my data as certain flags do not correlate easily, and I have to change the orignial SQL file, as well as the query inserted to excel to stay consistent. Also, I feel the pivot should be able to do this. Any solutions?
use a calculated field, and put the formula as = AND(flagB=1,flagC=1)
you can use multiple tests if you need to check for specific flags, just separate each test with a comma within the AND test (and more complex tests can be made with OR, or combinations of them both