I need help to make data coherent in excel - excel

I have database where a some data is inconsistent. This database summarize different variables among 10.000 industrial firms (e.g. number of employees, energy consumption, value of assets, among another 83 variables) over 10 years. My issue is that the firms change over time the International Standard Industrial Classification (ISIC) code and I need to put the same code to the firm in order to make a coherent analysis.
In the image you can see how the firm 987653 has two different ISIC code (textiles and Food manufacturing)
It is possible to have some help to create a formula to put a new ISIC code based on the most repeated value (in the example of the firm 987653 will be food manufacturing).

You can try following array formula to find most used code:
{=INDEX($D$2:$D$23,MODE(IF($A$2:$A$23=A2,MATCH($D$2:$D$23,$D$2:$D$23,0))))}
Array formula after editing is confirmed by pressing ctrl + shift + enter

A simple VLOOKUP should do what you want, if you can live with using the first ISIC for the company. eg:
F2: =VLOOKUP(B2,$B$1:$E$10,4,FALSE)

Related

How can I determine the 'total cost' from a tiered pricing structure using standard formulas in Excel?

I'm trying to evaluate various tiered pricing structures (for say, electricity plans) using Excel (more-or-less) to see what costing/plan is 'optimal', given some existing usage data I have.
Consider an example 'Table of Usage & Rates' (with fictitious but easily manipulated values):-
For a daily usage value of 120, we'd have 100 (in the 1st tier) and 20 (in the 2nd tier). The amount used within a tier gets charged at a certain rate (the 'factor')... and each 'tier charge' is addded together to form a total charge for the day.
So, we can calculate:-
100 x 8 = 800 ...a part of the total
20 x 4 = 80 ...another part of the total
...and that's all, giving a total of 880.
...but how to do that in a single formula within a cell?
I've done some pretty decent explorations for a few hours today, as I can't nut out how to deal with this... and most suggestions talk about multiple =IF formulas (cumbersome and unscalable - I shouldn't need to recode cell contents if I split/add another tier)... and suggestions with =VLOOKUP just don't 'click' with me ( = I don't understand them).
I'm actually using 'PlanMaker', a component of Softmaker's 'Office 2021' product to create/maintain this spreadsheet.. and there is no VBA-like plugin available.
I'd appreciate a method of attack, if anyone can suggest something, please...
So:
=product(10,8)+product(20,4)
or if we assume Factor starts in B9 then =product(A9,B9)+product(A10,B10+product(A11,B11)
then take the sum of those results etc assuming A9 is the amount used.
You can also use:
=sumproduct(A9:A11,B9:B11)
for the same but only needs one cell. And the advantage of a lot less typing.
You can include a 3rd array in sumproduct (or as many as needed) such as a binary value to include in the calculation or not.

Of the 10 individuals with the highest income, how many are married males?

Question --> Of the 10 individuals with the highest income, how many are married males?
I want to achieve the same in a single function.
Below is a database.
enter image description here
First I fetched data with Large and the applied vlookup and the used counifs to get the count.
enter image description here
enter image description here
You are close.
Why are you using IFERROR? Are there errors in the data or something else?
In the formula below, I used a Table and Structured references. An advantage is that the range references will automatically adjust. You can switch to normal addressing if you prefer.
I would use:
=COUNTIFS(myTable[Income],">="&LARGE(myTable[Income],10),myTable[Sex],"M",myTable[Married],"Yes")
With regard to your formula, you would think you could just SUM the results. Unfortunately, for any instance where there are duplicates (2 married men with same income in the top 10), your formula would return a 2 and not a 1 and the SUM would therefore be incorrect.
You can avoid that, with your approach, by converting any non-zero into a 1:
=SUM(--ISNUMBER(1/(COUNTIFS(myTable[Income],LARGE(myTable[Income],SEQUENCE(10)),myTable[Sex],"M",myTable[Married],"Yes"))))
However, I think my approach is simpler.

Calculating number of times one "team" beats another in Excel

(I use the term "teams" generically here because the entirety of this question rests on ranking, and it seemed to be the most intuitive language to describe my problem.)
In a league of 30 teams, each day only 8 teams play. The results for those teams are ranked ordinally from 1 to 8 for the day. This continues "forever", so that additional results must be recorded every day.
Example after 4 days:
I want to calculate a single number to describe the relationship between two teams. For instance, given the example, the value (in a 2d table) that describes the relationship of Ace to Get is 1. Ace beat Get twice and Get beat Ace once (2-1).
I have been messing with Sumproduct, Match, and Index to get get values, which I could calculate using many extra tables, but I may need to add "teams" on the fly, and I do not know how large the pool of teams will become. Because of this, I was hoping to be able to use a single formula in the 2d relationship table. The results of that table, looking at just day 1 and day 2 given the previous example, are:
Is there a direct formula I can use to calculate the results to populate that table?
You can try following formula:
=IF($A11<>B$10;
SUMPRODUCT(
IF(MMULT(($B$1:$I$1)*($B$2:$I$3=$A11);ROW($1:$8)^0)
<MMULT(($B$1:$I$1)*($B$2:$I$3=B$10);ROW($1:$8)^0);
1;
-1)
*(((MMULT(--($B$2:$I$3<>$A11);ROW($1:$8)^0)=8)
+(MMULT(--($B$2:$I$3<>B$10);ROW($1:$8)^0)=8))
=0));
"")
Copy right and down.

Calculating Multiple Averages

It's my first time posting a question to this forum. Though I have found answers here many times before, I have been unable to find a solution to my current predicament.
I work in a call center and each week I need to analyze data from the thousands of call that took place over the week. I'm new to programming in Excel-VBA but I've been able to get pretty far.
The data is produced by a third party program and the format is nigh unreadable. Much of the programming I've done so far has been geared towards making the data more organized. Now, I'd like to get into more analysis.
The data is arranged by employee number (NOT in order, though). Each employee takes several calls over the course of the week, some for which the customer takes a survey. It's the survey scores I want. I want to take the average of all the surveys for each employee and then display that average in the same row as each of the entries.
Example
The yellow highlighted area is what I want to add. Any ideas? Thanks for any help in advance!
No need for VBA. If you have the supported version of Excel you can use AVERAGEIF. If not you can use below formula.
Enter as an array formula by pressing Ctrl+Shift+Enter when exiting cell edit mode (instead of just enter).
=AVERAGE(IF($A$2:$A$13=A2,$B$2:$B$13))
Then copy down for all rows.

How Do I Nest IF Functions in Order to Calculate Daily Revenue?

I am working on a data set and I need to calculate the daily revenue of fake AirBnb listings using nested IF statements. This is for a bootcamp I am attending, and I am stuck.
My instructions are as follows:
Estimate revenue per listing
Assume each booking always has 2 guests, unless the listing accommodates only one;
The booking is always for the minimum number of days allowed;
Only half of the bookings generate a review;
The extra person charge is per night (column name ‘extra_people’)
○ Format: have a column that calculates daily revenue (account for number of guests accommodated, number of guests included in the price, extra charge for additional people - using nested IF statements); another column would then calculates revenue per booking; finally, multiply that by the number of total stays the listings has had.
Using the data in my dataset, I am attempting to fill out column AA. So far this is what I have for my formula,
However, I get an error. I know the first part of this formula would work for the scenario in row 4. However, I need to make sure that the formula takes into account scenarios where the "guests included" is less than the "accommodates", because I must assume that each booking always has two guests except for when the listing only accommodates one person.
How should this formula be written? Can I not create equations within nested if formulas if it includes adding, subtracting, dividing, or multiplying columns together?
To clarify the previous response a bit more, the structuring of IFstatements is important. Keep in mind the structure of the function: =IF(logical test, value if true, value if false). So, the second IF function (the first nested) needs to be placed where the first "value if false" comes in - each additional IF needs to be within the previous IF function. Using your example, the corrected form would be =IF(W4=Q4,V4,IF(W4<Q4,Q4*V4...)). I'm not sure what the "+X4" is supposed to be adding to, but this hopefully makes the structure clearer for you to work with. Good luck!

Resources