# Excel - IF Function Problem - Expert Solution

Question description:
This user has given permission to use the problem statement for this blog.

I want to relate costs to a certain devision if located in a certain month. The information and referrals are on different tabs
Solved by O. J. in 40 mins
This is the chat thread from the real Excelchat help session. It contains no private user information.
User 24/10/2017 - 07:19
Hello
User 24/10/2017 - 07:19
I have a complicated question
Excelchat Expert 24/10/2017 - 07:19
Hi
User 24/10/2017 - 07:19
I have the following list
Excelchat Expert 24/10/2017 - 07:20
User 24/10/2017 - 07:22
Ok
User 24/10/2017 - 07:22
I would like the following result
Excelchat Expert 24/10/2017 - 07:23
go on
User 24/10/2017 - 07:23
I want to allocate the total cost within a month (start en end date) to be sum in sheet 3 per devivio
User 24/10/2017 - 07:24
*devision
User 24/10/2017 - 07:25
so the autcome for Jan for apple should be: 350
User 24/10/2017 - 07:26
1 time material 1 (100) and one time 2 (250) and 3 (300), so 650 excuse me
Excelchat Expert 24/10/2017 - 07:26
last entry for apple is 2018 or 2017?
User 24/10/2017 - 07:27
Excelchat Expert 24/10/2017 - 07:27
so usually each entry will be for one month?
User 24/10/2017 - 07:27
yeah most of them
User 24/10/2017 - 07:27
some are for more
User 24/10/2017 - 07:28
That would make it worse right? Because then you have to spread it over time
Excelchat Expert 24/10/2017 - 07:29
yes that would make it nearly impossible to code in excel
User 24/10/2017 - 07:29
yeah so the first is already perfect
User 24/10/2017 - 07:29
without spreading over time. I will solve that myself
Excelchat Expert 24/10/2017 - 07:30
so the dates, if any entry is in January at any date of that month that will be counted as January product?
User 24/10/2017 - 07:30
yes
User 24/10/2017 - 07:31
sumif for all cost in that month if related to apple for instance
User 24/10/2017 - 07:44
I'ts like watching a triller
Excelchat Expert 24/10/2017 - 07:46
you will need vba
Excelchat Expert 24/10/2017 - 07:46
Look the formula I just created
User 24/10/2017 - 07:47
Yes
Excelchat Expert 24/10/2017 - 07:47
This formula for each division has to be applied but the formula must go for all the cells of sheet1 first column
Excelchat Expert 24/10/2017 - 07:47
like some for loop
User 24/10/2017 - 07:48
You used a singel cel instead of a row to calculate?
User 24/10/2017 - 07:48
ah ok
User 24/10/2017 - 07:48
Because it should be 200 right?
Excelchat Expert 24/10/2017 - 07:48
you cannot use a row sum formula here
Excelchat Expert 24/10/2017 - 07:48
yes
Excelchat Expert 24/10/2017 - 07:48
I just take the first cell as sample
Excelchat Expert 24/10/2017 - 07:48
wait giving you a demo
User 24/10/2017 - 07:49
ok
Excelchat Expert 24/10/2017 - 07:52
now check
Excelchat Expert 24/10/2017 - 07:52
I have gone upto 3rd row
User 24/10/2017 - 07:52
ah ok
Excelchat Expert 24/10/2017 - 07:52
pasting the same if-else thrice
User 24/10/2017 - 07:53
Yes I understand
User 24/10/2017 - 07:53
This if for 1 row in a time
Excelchat Expert 24/10/2017 - 07:53
so if you need to do it for all the cells that number of time this formula needs to be pasted
User 24/10/2017 - 07:53
Can I retrieve from column also?
Excelchat Expert 24/10/2017 - 07:53
yes
User 24/10/2017 - 07:53
awesome
Excelchat Expert 24/10/2017 - 07:54
but without vba you cannot simplify this
User 24/10/2017 - 07:54
I don't know what vba is
Excelchat Expert 24/10/2017 - 07:54
I am sorry I have some knowledge in vba but I need time
Excelchat Expert 24/10/2017 - 07:54
In VBA you can have some loops like we need here
User 24/10/2017 - 07:54
ah ok
User 24/10/2017 - 07:55
You thought me array already last time
User 24/10/2017 - 07:55
somday I will know it all :P
User 24/10/2017 - 07:55
I will look it up on the internet
User 24/10/2017 - 07:55
Tnx for your support so far.
Excelchat Expert 24/10/2017 - 07:55
you can post this problem as vba
Excelchat Expert 24/10/2017 - 07:55
some one with better knowledge in vba can hlep you around
User 24/10/2017 - 07:55
Ok
User 24/10/2017 - 07:56
tnx a lot
Excelchat Expert 24/10/2017 - 07:56
copy the code, that might save you some time
User 24/10/2017 - 07:56
Yes I did and download the excel as example to understand it more
User 24/10/2017 - 07:56
bye
Excelchat Expert 24/10/2017 - 07:56
what I was doing was looking if the division was apple and month was january
Excelchat Expert 24/10/2017 - 07:57
then sum
Excelchat Expert 24/10/2017 - 07:57
Excelchat Expert 24/10/2017 - 07:57
as your sum involves values from two different sheets and also includes multiplication too
User 24/10/2017 - 07:58
Yeah, my template for budget got many tabs but most referrals come from same tab
User 24/10/2017 - 07:58
hence the difficult texts
Excelchat Expert 24/10/2017 - 07:58
plaese note these, whoever you are gonna ask for help, this infos can save your time
User 24/10/2017 - 07:59
User 24/10/2017 - 07:59
ok before we run out of time
User 24/10/2017 - 07:59
tnx again, you rock!
Excelchat Expert 24/10/2017 - 07:59
I am gonan lookover your problem if vba can be applied , but I am running out of time here
Excelchat Expert 24/10/2017 - 07:59
sorry

This is the output file from the real Excelchat help session:
This is an example of the expert help you can get. It contains no private user information.

Get instant expert help with Excel and Google Sheets

#### Post your problem and you’ll get expert help in seconds.

Your message must be at least 40 characters
Your privacy is guaranteed. Your session will not be used for blog unless you give us persmission.