Excel logic - matching columns - vba

My situation is the following:
The 'Day' column is 1 to 365, and each day is repeated 24 times (for the 24 hours). Each day and hour together have a Degree value, represented by the B column. I need to multiple the B column with the E column everytime A column matches D (eg. B2*E2, B3*E2, B4*E2, B7*E3).
How can I do that? I'm really confused here.
Thank you

Using your shown example, in cell C2 and copied down:
=B2*VLOOKUP(A2,$D$2:$E$366,2,FALSE)

Two ways:
VLOOKUP(A2,$D$2:$E$366,2,FALSE)*B2
SUMPRODUCT(B2*($D$2:$D$366=A2)*$E$2:$E366)

Related

Not sure how to create a SQL formula that subtracts timestamps in the same column to get the seconds between actions

Need assistance with creating a "datediff" type of formula.
I have timestamps in the {incilog} table, in different rows across the same column {incilog.timestamp} that I need to subtract from one another, but only if the {incilog.transtype} equals "TR" from the row that has the {incilog.transtype} equal "FPS".
Logic is: If {incilog.transtype} equals "TR" and {incilog.transtype} equals "FPS", then subtract {incilog.timestamp} from {inciog.timestamp} in the corresponding row.
Basically, I need to get how many seconds it took from "TR" to "FPS".
THANK YOU FOR YOUR TIME AND ASSISTANCE!
EXAMPLE OF DATA
timestamp
inci_id
transtype
descript
8/22/2022 12:14:46 AM
2022264051
TR
Time Received
8/22/2022 12:17:00 AM
2022264051
FPS
Fire Pri. Started

SQL LAG function

I tried using the LAG function to calculate the value of previous weeks, but there are gaps in the data due to the fact that certain weeks are missing.
This is the table:
The problem is that the LAG functions takes the previous found week in the table. But I would like it to be zero if the previous week is not consecutive previous week.
This is what I would like it to be:
I'm open to any solutions.
Thank you in advance
Your example data is baffling. You have multiple rows per time frame. The first column looks like a string, which doesn't really make sense for the comparison.
So, let me answer based on a simpler data mode. The answer is to use range. If you had an integer column that specified the time frame:
ordering sales
1 10
2 20
3 30
5 50
Then you would phrase this as:
select max(sales) over (order by ordering range between 1 preceding and 1 preceding)
This would return the value from the "previous" row as defined by the first column. The value would be in a separate column, not a separate row.

how to group rows based on a dates in a single column

I have a range of date (A1:CY7026) with a column for start dates. this column has a large amount of repeated dates within it. i need these dates group together based on the working week they are located in (eg. all values reading 16/7/18 - 22/07/18 would be one group and the following week would make up another).
Use below in B2 cell (Suppose you had a header column) and drag to the rest. Sort to obtain the desired result.
=CONCATENATE(YEAR(A2),"-",WEEKNUM(A2))

Date Time is not being pulled from the database where numbers from the same column are being pulled in my report

I have two columns:
The first column can only have values 1 or 2.
if 1, then my second column has a number.
if 2, then my second column has a Date Time -( something like this 1/1/2014 12:00:00 AM ).
What I am doing:
I have a tablix with 2 columns..
First column is named a and second is named b
under first I want numbers and under second I want the date time. Basically want to split the second column based on what's on first column i.e. 1 or 2
I have used expressions:
=IIF(Fields!first_column.Value=1, Fields!second_column.Value,nothing)
and for second
=IIF(Fields!first_column.Value=2, Fields!Second_column.Value,nothing)
it works prefectly for the number and gives result whereas the column where there should be the date time gives blank with no results. I have tried switching them, using numbers on both and using dates on both column. but every attempt the numbers work the date time doesnt work.
If I was too wordy and didnt make sense, please let me know and I can answer your specific qustions.
Thank you.

SSRS Multiple Dates returned from Dataset, want to display 1 date per column

I apologize if this is a stupid question..as I am new to SSRS. I have a dataset that returns about 15 dates e.g
01/01/2013
01/05/2013
01/20/2013
01/25/2013
..etc
and I want to put each one of those dates in a new column next to itself like the following:
Day1 Day2 Day3 Day 5
01/01/2013 01/05/2013 01/20/2013 01/25/2013
any idea on how to do so? I would really appreciate the help
Build a table/matrix and create a column group that contains your date field. It will expand the dates out horizontally when it renders. Here is a link that contains instructions to add a column group to an existing table.
If you have fixed number of dates (15 in your case) then you can use pivot in SQL and let your dataset return dates in horizontal format (i.e 1 row with 15 columns) otherwise you can use column grouping to achieve this.
Thanks,
Neeraj